Reputation: 45692
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>
Upvotes: 4
Views: 3252
Reputation: 4930
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.
Upvotes: 8