set counter i n react

 



<button className=“btn btn-success” onClick={() => setCount(1)}>Reset</button>

const [count, setCount] = useState(1);
<button className=“btn btn-primary” onClick={() => setCount(prevCount => prevCount1)}></button>
<input className=“” type=“text” value={count}></input>
<button className=“btn btn-primary” onClick={() => setCount(prevCount => prevCount + 1)}>+</button>

Leave a Comment

Your email address will not be published. Required fields are marked *