Created
June 3, 2022 09:08
-
-
Save oney/04fabf4f12098fa9d5a0f0976dfefd93 to your computer and use it in GitHub Desktop.
Revisions
-
oney created this gist
Jun 3, 2022 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,15 @@ 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}); }