3 ms·
eventEmitter.addEventListener returns a unsubscribe function to remove the event listeners. useEffect hook calls the passed function's return value if it is not
by fatih-erikli 5y ago
eventEmitter.addEventListener returns a unsubscribe function to remove the event listeners. useEffect hook calls the passed function's return value if it is not a void.
https://reactjs.org/docs/hooks-effect.html#example-using-hooks-1 https://reactjs.org/docs/hooks-effect.html#example-using-hoo...
So my eventEmitter.addEventListener method in the blog post returns an ubsubscriber when you call it :)