``` <Route path="news" component={News}> //二級路由 <IndexRedirect to="Inside"/> <Router path="outside" component={Outside} onLeave={()=>{ console.log(arguments)}}/> <Router path="Inside" component={Inside}/> </Route> ```
``` <Route path="news" component={News}> //二級路由 <IndexRedirect to="Inside"/> <Router path="outside" component={Outside} onLeave={()=>{ console.log(arguments)}}/> <Router path="Inside" component={Inside}/> </Route> ```
<IndexRedirect to='home'/>
<Redirect from="*" to="home"/>
``` <Route path="detail/:id" component={Detail}/> <Link query={{text:item.text}} to={`/detail/${item.id}`}>{item.text}</Link> ```
``` const routeConfig = [ { path: '/', component: App, indexRoute: { component: Home }, childRoutes: [ { path: 'home', component: Home }, { path: 'news', component: News, childRoutes: [ { path: 'inside', component: Inside }, { path: 'outside',component:Outside} ] }, { path: 'detail/:id', component: Detail }, {path:'*',component:Home} ] } ] ReactDOM.render( <Router routes={routeConfig} history={hashHistory}></Router> ,document.getElementById('app')) ```
``` <Link activeClassName = {'active'} to={item.path} key={item.id}>{item.text}</Link> ```