Created
January 28, 2022 11:18
-
-
Save andresroberto/7553ed365dd97e34bcfb5720752e17aa to your computer and use it in GitHub Desktop.
This file contains 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 characters
useEffect(() => { | |
const controller = new AbortController(); | |
window.addEventListener('event1', callback1, { signal: controller.signal }); | |
window.addEventListener('event2', callback2, { signal: controller.signal }); | |
return () => { controller.abort(); }; | |
}, []); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment