📜  react useState - Javascript代码示例

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

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