import { useState } from 'react';
function App() {
const [count, setCount] = useState(0);
return (
<div style={{ textAlign: 'center' }}>
<p>当前计数: {count}</p>
<button onClick={() => setCount(count + 1)}>+</button>
<button onClick={() => setCount(count - 1)}>-</button>
</div>
);
}
export default App;