this.context.router.push() 不能跳转

代码:
class Component extends React.Component {

static contextTypes = {
    router:PropTypes.object.isRequired
};
handleSubmit (e) {
   ...
    fetch('xxx', {
        ...
    })
        .then(...)
        .then((res) => {
            if (...) {
                this.context.router.push('xxx');
                return;
                ...

报错:图片描述

不太明白这个报错_this2是什么意思

阅读 3k
1 个回答

this.context.router.history.push

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题