Last active
December 29, 2020 01:54
-
-
Save heron2014/b2d03b8b7622a255a47c5082576c6982 to your computer and use it in GitHub Desktop.
Key takeaways for useEffect
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(fn) // run function on every render | |
useEffect(fn, []) // run function only when the component is first rendered | |
useEffect(fn, [value]) //run function when component is first rendered and when the `value` changes | |
// Remember if you pass dependency(value) which is an object - React perform | |
// strict comparision using "===" of the first level properties and will not | |
// conduct comparisons deeper into the properties. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment