Redirect
Redirect 组件主要完成重定向功能,除了与 Route 一样具有控制匹配的exact、strict和sensitive以外,主要还是通过属性to、from和push来完成重定向功能。
to,接受一个字符串或者一个导航描述对象,来表达重定向到的位置。push,表示重定向到的路径是推入历史栈顶还是替换整个历史栈,默认为替换。from,用于指定匹配什么路径时才产生重定向。
<Switch>
<Route exact path="/old">
<Redirect push to="/new" />
</Route>
<Route path="/new" component={Place} />
</Switch>;