export default function Counter() {
const [count,setCount] = useState(0);
function handleIncrement(){
setCount(count +1);
}
return (
<div>
<p>{count}</p>
<button onClick={ _=>{handleIncrement()}}>Increment</button>
<button>Decrement</button>
</div>
);
}
export default function Counter() {
const [count, setCount] = useState(0);
const handleIncrement = () => {
setCount(count + 1);
};
return (
<div>
<p>{count}</p>
<button onClick={ handleIncrement }>Increment</button>
<button>Decrement</button>
</div>
);
}