Created
June 18, 2022 08:00
-
-
Save GuillaumeDaviid/f1864897fb4a34964f12a0d2caa02911 to your computer and use it in GitHub Desktop.
hooks : example 1
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(() => { | |
const timer = window.setInterval(() => { | |
setState(n => n + 1), 1000) | |
return function () { | |
clearInterval(timer) | |
} | |
}, []) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment