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
// useEffect hook run in mount and every state change if no dependency array is provided | |
useEffect(() => { | |
return () => { | |
console.log("unmounting component"); | |
}; | |
}, []); |
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
// 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); | |
}) |
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
// useEffect hook run in mount if empty dependency array is provided | |
useEffect(() => { | |
console.log('component mount', count); | |
console.log('component update', count); | |
}, []) |
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
// 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]) |