IndexRedirect

用于给父路由提供默认跳转,与 不同的是,URL 路径会发生变化。

  1. // 下面的路由可以将首页重定向到 /hello
  2. <Route path="/" component={App}>
  3. <IndexRedirect to="/hello" />
  4. </Route>

属性

to { String }

需要重定向到的新路由,除了没有 from 属性外,其余与 <Redirect> 组件相同。