重定向到索引

时间:2016-10-26 07:02:57

标签: reactjs react-router

使用react-router v。 2.8.1 我无法重定向到索引页面。从 / login

成功登录后,我想重定向到那里

我用

static contextTypes = {
        router: React.PropTypes.object
   };

   ...

   this.context.router.push('/');

我还尝试了已弃用的hashHistory

router.hashHistory.push('/');

如果我提供任何其他路径,例如消息它正确地重定向我。

this.context.router.push('/messages');

如何使用react-router重定向到索引?

0 个答案:

没有答案