Last active
December 15, 2020 03:19
-
-
Save tpjnorton/826a84525d86bb7c3c4e6187c62abdf5 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
const useMounted = () => { | |
const isMounted = useRef(false); | |
useEffect(() => { | |
isMounted.current = true; | |
return () => { | |
isMounted.current = false; | |
}; | |
}, []); | |
return isMounted; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment