ReactDOM.render(
<Provider store={Store}>
<HashRouter>
<App />
</HashRouter>
</Provider>
, document.getElementById('root'));在组件中连接store
以前用的是connect ;
发现在组件中用
static contextTypes = {
store: PropTypes.object.isRequired,
};
然后
const { store } = this.context也可以取到 store ;
想问哪种方式比较好?
茅侃侃
慕村9548890
料青山看我应如是
随时随地看视频慕课网APP