::: tip 更多描述
function App() {
const [count, setCount] = useState(0);
const incr = () => {
setTimeout(() => {
setCount(count + 1);
}, 3000);
};
return <h1 onClick={incr}>{count}</h1>;
}
当连续点击 10 次时,会输出多少 :::
::: tip Issue 欢迎在 Issue 中交流与讨论: Issue 373 :::
::: tip Author 回答者: zckpp :::
应该是1吧,在state被update之前count一直还是0