react-router 从 redux async action creator 获取 this.props.router?
react-router get this.props.router from redux async action creator?
使用 react-router 2.8.1 和 with-router
HOC
我可以通过 this.props.router.push(url)
以编程方式导航
我想在 redux async action creator 中完成。
http://redux.js.org/docs/advanced/AsyncActions.html#async-action-creators
我可以从异步动作创建器获取状态,但不能获取道具。
如何获取道具?
如果您需要 action creator 中不处于 redux 状态的东西,您需要在分派 action 时将其作为参数传递。
不清楚您需要从道具中获取哪些数据,但如果您只想在动作创建器中进行重定向,您可以 import { browserHistory } from 'react-router'
并执行 browserHistory.push(url)
.
使用 react-router 2.8.1 和 with-router
HOC
我可以通过 this.props.router.push(url)
我想在 redux async action creator 中完成。 http://redux.js.org/docs/advanced/AsyncActions.html#async-action-creators
我可以从异步动作创建器获取状态,但不能获取道具。
如何获取道具?
如果您需要 action creator 中不处于 redux 状态的东西,您需要在分派 action 时将其作为参数传递。
不清楚您需要从道具中获取哪些数据,但如果您只想在动作创建器中进行重定向,您可以 import { browserHistory } from 'react-router'
并执行 browserHistory.push(url)
.