reactrouter路由重定向⽂档
⽰例
const {
HashRouter,
Route,
Switch,
Redirect,
} = window.ReactRouterDOM
return (
<HashRouter>
<Switch>
<Route exact path="/">
{`<Home />`}
</Route>
<Route path="/old-match"> {/* 重定向 */}
<Redirect to="/will-match" />
</Route>
<Route path="/will-match">
{`<WillMatch />`}
</Route>
<Route path="*"> {/* 404 */}
{`<NoMatch />`}
</Route>
react router拦截</Switch>
</HashRouter>
)