Note: I added an extra button that calls the same function inside the LioWebRTC wrapper, and the current state does print for that, so it seems like it's something to do with LioWebRTC itself. How is that even possible for it not to use the current state?
Somehow, the function passed to
onReceivedPeerData
only ever uses the initial value for a state variable, never its current state. Here's a bare minimum example: https://stackoverflow.com/questions/71447566/react-state-variables-not-updating-in-functionNote: I added an extra button that calls the same function inside the LioWebRTC wrapper, and the current state does print for that, so it seems like it's something to do with LioWebRTC itself. How is that even possible for it not to use the current state?