You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/API.md
+13-1Lines changed: 13 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -159,7 +159,19 @@ Given a route like `<Route path="/users/:userId" />`:
159
159
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.
160
160
161
161
### `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.
163
175
164
176
You can explicit specify `router` as a prop to the wrapper component to override the router object from context.
0 commit comments