React-Router - Index Routes and Index Links

IndexRoute 默认子路由

当跳转到父路径的时候,这个默认组件自动render

<Router>
<Route path="/" component={App}>
<IndexRoute component={Home}/>
<Route path="accounts" component={Accounts}/>
<Route path="statements" component={Statements}/>
</Route>
</Router>

Index Redirects

自动跳转
redirect / to /welcome

<Route path="/" component={App}>
<IndexRedirect to="/welcome" />
<Route path="welcome" component={Welcome} />
<Route path="about" component={About} />
</Route>

这个给跟路径用到,为的是解决 默认的link的 active状态

<IndexLink to="/">Home</IndexLink>.