Last active
May 23, 2022 11:28
-
-
Save alpavlove/6730bfaab27ddedd22688baeb2b42454 to your computer and use it in GitHub Desktop.
React Hooks instead of lifecycle methods - useEffect hook instead of componentDidMount
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
//componentDidMount and componentDidUpdate. An effect re-runs every render | |
useEffect(() => { | |
// to do smth... | |
}) | |
//componentDidMount. An effect runs only on mount | |
useEffect(() => { | |
// to do smth... | |
}, []) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment