ReactNativeUtil icon indicating copy to clipboard operation
ReactNativeUtil copied to clipboard

redux如何获取全局store

Open wuyunqiang opened this issue 7 years ago • 0 comments

redux的数据是在配置时候传入的,只能使用自己的部分,那么我们获取其他部分的store该如何做呢? 其实redux的数据的传递也是通过context做到的,如果大家不熟悉可以去搜索一下关于context的文章 context文章 学习一下这里只讲方法: 1:直接设置

static contextTypes = {
        store: PropTypes.object,
    };

2: console.log('store getState',this.context.store.getState());//获取全局store

wuyunqiang avatar Nov 28 '17 08:11 wuyunqiang