我在app组件能获取到provider里面的store.
但是在app组件里的 {this.props.children},也就是router里面的三个子router 怎么获取store呢?
我在app组件能获取到provider里面的store.
但是在app组件里的 {this.props.children},也就是router里面的三个子router 怎么获取store呢?
react-redux将组件分为container和component,component为纯展示组件,逻辑操作和状态控制需要放在container组件中,也就是你想要的在子router中获取store的工作应该放在container中。详细的教程可以参考阮一峰老师的这篇文章http://www.ruanyifeng.com/blog/2016/09/redux_tutorial_part_three_react-redux.html