让函数组件具备 state 能力的 Hook
import React, {useState} from 'react';const App = (props) => {const [count, setCount] = useState(0);return (<div><div>{count}</div></div>)}
setCount(count + 1);setCount((count) => {count++;console.log(count);return count;});
- 直接赋值
 - 使用回调函数 :::warning 使用 hook 的 setState 不会像类组件的 this.setState 会自动合并对象。所以要自己使用 … 剩余操作符作处理 :::
 
