【发布时间】:2019-06-12 07:28:46
【问题描述】:
我在我的项目中使用 Redux 和 React。我在 App.js 中有一些路由。我还在我的项目中使用 react-redux 中的连接功能。为了防止更新阻塞问题,我通常以这种方式包装我的组件
withRouter(connect(mapStateToProps, mapDispatchToProps)(App)),
但是,如果我更改了 withRouter 的顺序并连接它不起作用:
connect(mapStateToProps, mapDispatchToProps)(withRouter(App))
我有 console.log App.js 中的道具。它已经接收到位置和历史道具。我正在弄清楚为什么顺序很重要背后的理论?
【问题讨论】:
标签: javascript reactjs redux react-redux frontend