6
我使用的瀏覽器歷史記錄,這裏是我的routes.js如何解決「路由器不再默認歷史道具哈希歷史」的警告?
export default (
<Router history={browserHistory}>
<Route path="/" component={Main}>
<Route path="home/:username" component={Home}>
<IndexRoute component={HomeContent}></IndexRoute>
<Route path="widget/:second" component={Widget}></Route>
<Route path="email/:second" component={Email}>
<Route path="compose" component={ComposeEmail}></Route>
<IndexRoute component={CheckEmail}></IndexRoute>
</Route>
<Route path="social/:second" component={Social}></Route>
<Route path="calendar/:second" component={Calendar}></Route>
</Route>
<IndexRoute component={Login}></IndexRoute>
</Route>
</Router>
);
碼,我用this.context.router.push(「/」)進行導航。我不知道爲什麼這個警告會一直顯示在我的控制檯中?
"Warning: [react-router] `Router` no longer defaults the history prop to hash history. Please use the `hashHistory` singleton instead."
我已閱讀文檔https://github.com/reactjs/react-router/blob/master/upgrade-guides/v2.0.0.md#no-default-history,但它並沒有真正的幫助。
我知道的任何幫助:)
你能不能更新這段代碼片段來爲'react-router'包含'import'或'require'語句? – sighrobot