美文网首页
react路由

react路由

作者: 书简_yu | 来源:发表于2019-02-26 23:32 被阅读0次

    主页,登陆,注册

    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

    相关文章

      网友评论

          本文标题:react路由

          本文链接:https://www.haomeiwen.com/subject/bpetuqtx.html