Last active
May 22, 2021 17:26
-
-
Save shailesh87/66c79f0fe6b7e93a5a1a5ea48fed078a to your computer and use it in GitHub Desktop.
Example of useEffect hook in all three state of lifecycle
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 hook run in mount and every state change if no dependency array is provided | |
useEffect(() => { | |
console.log('component mount', count); | |
console.log('component update', count); | |
},[count]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment