Skip to content

Commit 219f40f

Browse files
nsfmctimdorr
authored andcommitted
updates withRouter docs to describe all injected props. (remix-run#5001)
previously implied that only `router` was injected, but `location`, `params` and `routes` are also injected.
1 parent a21a36a commit 219f40f

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

docs/API.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,19 @@ Given a route like `<Route path="/users/:userId" />`:
159159
An `<IndexLink>` is like a [`<Link>`](#link), except it is only active when the current route is exactly the linked route. It is equivalent to `<Link>` with the `onlyActiveOnIndex` prop set.
160160

161161
### `withRouter(Component, [options])`
162-
A HoC (higher-order component) that wraps another component to provide `props.router`. Pass in your component and it will return the wrapped component.
162+
A HoC (higher-order component) that wraps another component to enhance its props with router props.
163+
164+
```
165+
withRouterProps = {
166+
...componentProps,
167+
router,
168+
params,
169+
location,
170+
routes
171+
}
172+
```
173+
174+
Pass in your component and it will return the wrapped component.
163175

164176
You can explicit specify `router` as a prop to the wrapper component to override the router object from context.
165177

0 commit comments

Comments
 (0)