DEV Community

Discussion on: How to prevent multiple socket connections and events in React

Collapse
 
itminhnhut profile image
itminhnhut • Edited

if i have MyComponent and MyComponent2 use socket.on('receive_event', eventHandler);
if MyComponent2 use socket.off('receive_event').on('receive_event',()=> function)
is MyComponent have is off after on like MyComponent2 ? .
i want MyComponent2 change socket on is MyComponent no action . How ?.