Javascript 反应路由器:IndexRoute vs DefaultRoute
我想知道下面示例中的Javascript 反应路由器:IndexRoute vs DefaultRoute,javascript,reactjs,react-router,Javascript,Reactjs,React Router,我想知道下面示例中的IndexRoute和DefaultRoute之间有什么区别?据我所知,在这两种情况下,Home都将被渲染,对吗 <Route path="/" handler={App}> <IndexRoute handler={Home}/> <Route path="about" handler={About}/> </Route> 及 DefaultRoute从react router v1.0开始消失索引路由 从文档中
IndexRoute
和DefaultRoute
之间有什么区别?据我所知,在这两种情况下,Home
都将被渲染,对吗
<Route path="/" handler={App}>
<IndexRoute handler={Home}/>
<Route path="about" handler={About}/>
</Route>
及
DefaultRoute
从react router v1.0开始消失<改为引入代码>索引路由
从文档中:
// v0.13.x
// with this route config
<Route path="/" handler={App}>
<DefaultRoute name="home" handler={Home}/>
<Route name="about" handler={About}/>
</Route>
// v1.0
<Route path="/" component={App}>
<IndexRoute component={Home}/>
<Route path="about" component={About}/>
</Route>
//v0.13.x
//使用此路由配置
//v1.0
更多关于
// v0.13.x
// with this route config
<Route path="/" handler={App}>
<DefaultRoute name="home" handler={Home}/>
<Route name="about" handler={About}/>
</Route>
// v1.0
<Route path="/" component={App}>
<IndexRoute component={Home}/>
<Route path="about" component={About}/>
</Route>