diff --git a/src/Counter.js b/src/Counter.js index 30052ce3757dfaf0c528abc250b56eae9aef9502..a9d96ea645e5d23fd8ad2b5cfc7200a64e8bfe71 100644 --- a/src/Counter.js +++ b/src/Counter.js @@ -1,7 +1,10 @@ import { useState } from "react"; const Counter = (props) => { - const [count, setCount] = useState(0); +/* const [count, setCount] = useState(0); + const whenUclick = () => setCount(count+1);*/ + let lecompte = 0; + const quantuclic = () => lecompte = lecompte+1; return ( <div class="card" style={{width:"auto", margin: '2em'}}> <div class="card-header"> @@ -10,12 +13,12 @@ const Counter = (props) => { <button type="button" class="btn btn-primary" - onClick={()=>setCount(count+1)} + onClick={quantuclic} style={{margin: "1em"}} > Ce bouton incrémente </button> - <p style={{margin: "1em auto"}}>Là genre ça vaut {count}</p> + <p style={{margin: "1em auto"}}>Là genre ça vaut {lecompte}</p> </div> ) };