为什么要通过redux而不是store.dispatch / store.getState()

问题描述 投票:0回答:1

我一直使用redux-thunk或某种中间件来授予我对dispatch / getState的访问权限,但是我有一个问题一直困扰着我。当我们可以导入商店并调用store.dispatch()/ store.getState()时为什么使用它?

redux react-redux middleware redux-thunk
1个回答
0
投票

[我们称store.dispatch来“重新启动”从第一个中间件开始发送操作的过程,而不是将其传递到下一个中​​间件将解释/分发它的下一个。

© www.soinside.com 2019 - 2024. All rights reserved.