主页,登陆,注册
return (
<Router>
<Switch>
<Route exact path='/' component={AA} />
<Route path='/login' component={BB} />
<Route path='/register' component={CC} />
<Redirect to='/login'/>
</Switch>
</Router>
);
react router
基础组件
// Routers
<BrowserRouter> and <HashRouter>
// Route Matching
<Route> and <Switch>
component render children
// Navigation
<Link> and <NavLink>
- 参考
react router https://reacttraining.com/react-router/web/guides/basic-components
网友评论