State not updating inside socket.on custom event #4227
Unanswered
omkarajagunde
asked this question in
Q&A
Replies: 1 comment
-
Hi! That's quite a big code example 😄 could you please try to reduce it to the bare minimum? (and include the server logic) You can also check the React Native example here: https://github.com/socketio/socket.io/tree/master/examples/react-native |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello peeps,
I am trying to make a realtime chatting app, using nextjs - 12.0.4, socket.io-client - "^4.4.0", react - "17.0.2" (hooks), here is the code snippet where the setState is not updating the "userFoundFlag"
not finding any concrete help on forums/blogs hence putting this here
any ideas/suggestions/help is very much appreciated, Thanks!
for debugging purposes please refer to full code below especially the "socketRef.current.on("CLIENT_PAIRED..." inside useEffect()
full code is here
Beta Was this translation helpful? Give feedback.
All reactions