Created
October 20, 2022 09:48
-
-
Save GuillaumeDaviid/9fa2ee3315bc9768fd525ee3e3c2658a to your computer and use it in GitHub Desktop.
useEffect 4
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` ; | |
| }, [count]) ; | |
| 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