一个有趣的react问题
虽然 我知道是不能这样写
但还是想问个为啥 点了后 Count的 值显示为啥会 1000 / 1001 / 1000/ 1001 ...
import { useState } from 'react';
import { Button } from 'antd'
export default function FunctionComp() {
let [count, setCount] = useState(0); // 返回值为 Array
let nums = 999;
return (
<>
<Button onClick={() => { setCount(++count) }} type="primary">{count}</Button>
<Button onClick={() => { setCount(++nums) }} type="primary">{nums}</Button>
</>
)
}