我使用的反应,路由器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