📜  响应更改状态 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:54.551000             🧑  作者: Mango

代码示例3
//initial state
const [state, setState] = useState(0)
//change state
setState(1)
//change state with prev state value
setState((prevState) => {prevState + 2}) // 3