React 本机导航如何将其连接到 Redux 状态?
React native navigation how to connect it to Redux state?
我在下面注意到 navigate
一旦将 Redux 状态传递给另一个组件,即使 Redux 数据已更新,它也不会更新 Redux 状态。
navigation.navigate('anotherComponent', { firstname, lastname, loading, onRefresh });
在anotherComponent
中,
this.props.navigation.state.params
这工作正常,但一旦从前一个组件接收到状态,就不会更新 Redux 状态值。更新 Redux 状态不会改变 anotherComponent
.
中的任何内容
如何连接到 Redux,以便 anotherCompoenet
在 Redux 更新时实际更新数据?
这可以在你连接 anotherComponen
和 redux 并在 redux 中保存你想要的信息到 anotherComponent
时实现。
我在下面注意到 navigate
一旦将 Redux 状态传递给另一个组件,即使 Redux 数据已更新,它也不会更新 Redux 状态。
navigation.navigate('anotherComponent', { firstname, lastname, loading, onRefresh });
在anotherComponent
中,
this.props.navigation.state.params
这工作正常,但一旦从前一个组件接收到状态,就不会更新 Redux 状态值。更新 Redux 状态不会改变 anotherComponent
.
如何连接到 Redux,以便 anotherCompoenet
在 Redux 更新时实际更新数据?
这可以在你连接 anotherComponen
和 redux 并在 redux 中保存你想要的信息到 anotherComponent
时实现。