React counter app
Result
Loading...
Live Editor
function Counter() { const [count, setCount] = useState(0); return ( <div> <button onClick={() => setCount((prev) => prev - 1)}>-</button> <button onClick={() => setCount((prev) => prev + 1)}>+</button> <p>clicked: {count}</p> </div> ); }