() => {
const { exec } = new DebounceClass()
const [count, setCount] = useState(0)
const plus = () => {
setCount(count + 1)
}
return (
<div>
<div>点击次数: {count}</div>
<hr />
<span
className="btn theme mr10"
onClick={e => {
plus()
}}
>
点击 + 1
</span>
<span
className="btn red mr10"
onClick={e => {
exec(plus, 1000)
}}
>
一秒之内的点击 + 1
</span>
</div>
)
}