I'm wondering what's the difference between IndexRoute
and DefaultRoute
in example below? As I understand in both cases Home
will be rendered, right?
<Route path="/" handler={App}>
<IndexRoute handler={Home}/>
<Route path="about" handler={About}/>
</Route>
and
<Route path="/" handler={App}>
<DefaultRoute handler={Home}/>
<Route path="about" handler={About}/>
</Route>
DefaultRoute
is gone as of react-router v1.0. IndexRoute
is introduced instead.
From the docs:
// 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>
More in the upgrade guide.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With