Created
October 20, 2022 09:46
-
-
Save GuillaumeDaviid/a30093437e1bc7f9bb544c1fe02faa47 to your computer and use it in GitHub Desktop.
useEffect 3
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