I want to access same event in two different useEffect in same page. I have tried doing this but its doesn't work Here is what I did. I just want to know if this possible to recieve same event in same page in two diffrent useEffect. Because in the first useEffect I am getting the data but not in the second. Or is there in trick which I can apply.
FIRST useEffect
useEffect(() => {
socket.on('event', () => {
console.log('WORK');
});
return () => {
socket.off('event');
};
}, []);
Second useEffect
useEffect(() => {
socket.on('event', () => {
console.log('NOT COMMING HERE');
});
return () => {
socket.off('event');
};
}, []);