我有这个useEffect钩子,它在componentDidMount上做一些事情,最后我想用它来更新我在componentWillUnMount上的redux商店。data = ordersToCancel //ordersToCancel is an empty array here as it's default value not the updated onedispatch({ type: 'someType', data: data })}, []) 正如在代码片段中提到的,ord
当它是一个功能组件时,我使用的是useState状态钩子,我可以向useState传递一个函数,它将更新最新的cursorIndex。Even though the update is asynchronous, somehow React this.setState({
cursorIndex: incrementor(this.state.cursorIn