Created
June 3, 2022 09:08
-
-
Save oney/04fabf4f12098fa9d5a0f0976dfefd93 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Chat({ selectedRoom }) { | |
const theme = useContext(ThemeContext); | |
useEffect(($) => { | |
const socket = createSocket('/chat/' + selectedRoom); | |
socket.on('connected', async () => { | |
showToast($.theme, 'Checking connection to ' + connectedRoom); | |
await checkConnection(selectedRoom); | |
showToast($.theme, 'Connected to ' + connectedRoom); | |
// $.theme is fresh anytime | |
}); | |
}, [selectedRoom], {theme}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment