React native Can';t在4.0.0版中调用getState

React native Can';t在4.0.0版中调用getState,react-native,redux,react-redux,React Native,Redux,React Redux,我已将我的存储定义如下(file store.js): 我在别的地方用这家店 import {store} from './store'; const mykey = store.getState().mykey ; 它有缺陷,但在3.7.2版中运行良好。我阅读了版本4.0.0的文档,其中描述了: 发送时调用getState、subscribe或unsubscribe时抛出 如何在其他位置获取存储的值?store.getState()从reducer中禁止调用。更多细节。从动作创建者那里,g

我已将我的存储定义如下(file store.js):

我在别的地方用这家店

import {store} from './store';
const mykey = store.getState().mykey ;

它有缺陷,但在3.7.2版中运行良好。我阅读了版本4.0.0的文档,其中描述了:

发送时调用getState、subscribe或unsubscribe时抛出

如何在其他位置获取存储的值?

store.getState()
从reducer中禁止调用。更多细节。从动作创建者那里,getState应该可以工作

import {store} from './store';
const mykey = store.getState().mykey ;