Answer the question
In order to leave comments, you need to log in
Do I need to unsubscribe from the socket from the react when componentWillUnmount?
Tell me, please, is it necessary to unsubscribe from the socket from the react when componentWillUnmount, if subscribed in the same component in componentDidMount? If you do not unsubscribe, will memory be clogged with garbage on each transition along the route, which the garbage collector on the server with the node cannot clean up?
Answer the question
In order to leave comments, you need to log in
Look in the browser in the network-> ws tab.
How much it clogs up, if every time you enter the component a new instance of the socket connection is created, then of course you need to cut it down.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question