Created
October 20, 2022 09:41
-
-
Save GuillaumeDaviid/cf8b02eab136db1b1bb7089ce96d1bda to your computer and use it in GitHub Desktop.
useEffect 2
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
| import {useEffect, useState} from ‘react’ ; | |
| function Component() { | |
| const [count, setCount] = useState(0) | |
| useEffect(() => { | |
| document.title = `Vous avez cliqué {count} fois` ; | |
| }) ; | |
| return( | |
| <> | |
| <p>Vous avez cliqué {count} fois</p> | |
| <button onCLick={() => setCount(count + 1)}> | |
| Cliquez ici | |
| </button> | |
| </> | |
| ) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment