Skip to content

Instantly share code, notes, and snippets.

@shailesh87
Last active May 22, 2021 17:26
Show Gist options
  • Save shailesh87/66c79f0fe6b7e93a5a1a5ea48fed078a to your computer and use it in GitHub Desktop.
Save shailesh87/66c79f0fe6b7e93a5a1a5ea48fed078a to your computer and use it in GitHub Desktop.
Example of useEffect hook in all three state of lifecycle
// 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