当我从第 1 行的 React 向 redux 发送操作时,我能否 100% 确定我的 React 组件中的第 2 行具有更新的 redux 状态?

When i dispatch action to redux from react in line 1 can i be 100% sure that line 2 in my react component has the updated redux state?

我知道 redux 中的调度操作是同步的。当我从第 1 行的反应组件向 redux 发送操作时,我能否 100% 确定我的反应组件中的第 2 行具有更新的 redux 状态?我正在通过调度 getGameDataSuccess(data) 操作来设置游戏数据。我能 100% 确定紧接着的下一行新道具会流下来吗? 现在当我 console.log(this.props.lostLetters.gameData) 时,我看到了新的游戏数据。但我能 100% 确定情况总是如此吗?

getLostLettersGame(this.props.gameCenter.selectedGame.gameId)
              .then((data) => {
                this.props.dispatch(LostLettersActions.getGameDataSuccess(data));
                console.log(this.props.lostLetters.gameData);
                this.generateGame();
              })

您不能 100% 确定更新后的状态会在调度调用后立即呈现。 mapStatetoProps 在组件即将重新渲染时被调用,这取决于 React 是否对更新进行批处理。默认情况下,React 从事件处理程序批处理更新。

可以参考https://github.com/reactjs/react-redux/issues/291