function Count() {
const [quantity, setQuantity] = useState(0);
const onIncrease = () => {
setQuantity((prevQuantity) => prevQuantity + 1);
};
const onDecrease = () => {
setQuantity((prevQuantity) => prevQuantity - 1);
};
return (
<button onClick={onDecrease}>-</button>
<div className="quantity">{quantity}</div>
<button onClick={onIncrease}>+</button>
);
}
export default Count;