0
我有一個像下面的定義我的根:反應路由工作不正常
<Route path="/" onEnter={this.verifyLang}>
<Route path="/:lang" onEnter={this.verifyLang}>
<IndexRoute component={this.getIndexRoute()} />
<Route path="auth">
<Route path="confirm-password" component={this.getIndexRoute()} />
<Route path="confirm-code/code=:code&email=:email" component={this.getIndexRoute()} />
<Route path="confirm_email" component={this.getIndexRoute()} />
</Route>
<Route path="landing" component={Landing} />
<Route path="impress" component={Impress} />
</Route>
</Route>
功能this.getIndexRoute()
給我啓動組件。現在在啓動組件我有一個方法:
componentWillReceiveProps(nextProps){
browserHistory.push('landing');
}
我期待着重定向到着陸組件,但沒有任何反應。爲什麼是這樣?
路由器什麼版本的?那是你引用的react-router'browserHistory'嗎? –
正確我猜它不是版本3 – Nitish
http://stackoverflow.com/a/31079244/438992所以如果一切都很好,我不知道這個問題會是什麼。 –