【发布时间】:2017-08-31 20:29:08
【问题描述】:
使用之前的 react-router 我能够做到这一点:
import {browserHistory} from 'react-router';
从我的 actionCreators 文件中,我可以执行以下操作:
...some async action completed (for example, user logged in successfully)..
browserHistory.push('/dashboard');
但是使用新的 react-router-dom (v4) 似乎我不能再像那样导入 browserHistory 并且访问历史对象的唯一方法是从 React 组件道具
this.props.history
在使用 react-router-dom 完成异步 redux 操作后,有什么方法可以将我的用户重定向到新页面?
【问题讨论】:
标签: reactjs redux react-router react-redux react-router-dom