Created
January 5, 2021 12:00
-
-
Save onion2k/a11739a8bf3f815ded51679a592d5d02 to your computer and use it in GitHub Desktop.
Using a hook in place of componentWillMount and componentWillUnmount
This file contains hidden or 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(()=>{ | |
| console.log("Mounted component") | |
| return () => { | |
| console.log("Unmounted component") | |
| }; | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment