express connected to react

This commit is contained in:
2022-06-04 12:53:04 -05:00
parent a9e0cba3a6
commit e7832ea58d
3 changed files with 16 additions and 35 deletions

View File

@@ -14,8 +14,9 @@ function App() {
}, [setSocket]);
useEffect(() => {
socket.on('connection', () => {
console.log(socket.id);
if (!socket) return;
socket.on('connection', (data) => {
console.log('connected!' + data);
})
}, [socket]);