Redirect
该组件支持参数:
// 下面的路由可以从 /profile/123 跳转到 /about/123
<Route path="/" component={App}>
<Route path="about/:userId" component={UserProfile} />
<Redirect from="profile/:userId" to="about/:userId" />
</Route>
同时也支持相对路由:
// 可以从 /course/123/home 跳转到 /course/123/dashboard
<Route path="course/:courseId">
<Route path="dashboard" />
<Redirect from="home" to="dashboard" />
</Route>
属性
from { String }
想要重定向的旧路由
to { String }
需要重定向到的新路由