Skip to content

React JS SocketIo-Client #4654

Discussion options

You must be logged in to vote

I think you need to remove the socket.disconnect() from the componentWillUnmount callback, because useEffect() is called twice with React 18 Strict Mode.

Reference: https://beta.reactjs.org/reference/react/StrictMode

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@Derrick-Tan-D-WEBDEV
Comment options

@darrachequesne
Comment options

Answer selected by darrachequesne
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants