Skip to content

Commit 84bf2ae

Browse files
committed
Merge pull request #3137 from MatthewHerbst/feature/index-redirect-better-docs
Improved IndexRedirect documentation
2 parents 06190b1 + 3d3ff23 commit 84bf2ae

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

docs/API.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,18 @@ All the same props as [Route](#route) except for `path`.
460460
### `<IndexRedirect>`
461461
An `<IndexRedirect>` allows you to redirect from the URL of a parent route to another route. They can be used to allow a child route to serve as the default route for its parent, while still keeping a distinct URL.
462462

463-
Please see the [Index Routes guide](/docs/guides/IndexRoutes.md).
463+
#### Example
464+
```js
465+
<Router>
466+
<Route path="/" component={App}>
467+
<IndexRedirect to="groups" />
468+
{/* If no child route is matched, will redirect to 'groups' */}
469+
470+
<Route path="groups" component={Groups} />
471+
<Route path="users" component={Users} />
472+
</Route>
473+
</Router>
474+
```
464475

465476
#### Props
466477
All the same props as [Redirect](#redirect) except for `from`.

0 commit comments

Comments
 (0)