Last active
January 27, 2020 04:48
-
-
Save JenniferFuBook/47a7d73560942ff309ffa970e39f2a49 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 App = () => { | |
... | |
const mounted = React.useRef(true); | |
React.useEffect(() => { | |
if (mounted.current) { | |
some setState commands | |
} | |
return () => { | |
mounted.current = false; | |
}; | |
}); | |
return ( | |
some rendering | |
); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment