Tim*_*ney 1 reactjs redux react-router-redux
使用https://github.com/reactjs/react-router-redux/
如果我想基于url查询params重新加载app(Redux)状态是获取state.routing.locationBeforeTransitions.query属性的正确方法吗?
它的工作原理......只是想知道这是否正确.
使用Redux连接组件,您可以从mapStateToProps的第二个参数访问路由器的props:
function mapStateToProps (state, ownProps) {
return {
num: state.items.num,
query: ownProps.location.query
}
}
export default connect(mapStateToProps, null)(YourComponent)
Run Code Online (Sandbox Code Playgroud)
您还可以在这里查看演示https://github.com/timarney/react-router-redux-query-params.
| 归档时间: |
|
| 查看次数: |
3588 次 |
| 最近记录: |