我使用的反應,路由器routes
參數:陣營路由器 - 重定向使用indexRoute
const rootRoute = {
component: App,
childRoutes: createRoutes(store),
indexRoute: { onEnter: (nextState, replace) => replace('/new-url') }
};
這裏是Router
JSX部分:
<Router
history={hashHistory}
routes={rootRoute}>
</Router>
的indexRoute
是我試圖線添加重定向但它不起作用。
@EQuimper除了indexRouter以外,一切都按預期工作,所以我猜測沒關係。 – Dekel
您可以使用[''](https://github.com/ReactTraining/react-router/blob/master/docs/guides/IndexRoutes.md#index-redirects)組件。 –
@MingSoon - 我需要這個作爲'rootRoute = {}'對象的一部分,你有這樣的例子嗎? – Dekel