Skip to content

Commit 34ba72d

Browse files
committed
Merge pull request #3389 from perrin4869/patch-1
Add additional props passing method
2 parents 03a6ad3 + 18e8f60 commit 34ba72d

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

docs/Troubleshooting.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,12 @@ There are multiple ways to do this depending on what you want to do. You can:
9292

9393
- Define additional values on `<Route>` or the plain route. This will make those values available on `this.props.route` on route components.
9494
- Pass in a `createElement` handler to `<Router>` or `<RouterContext>`. This will allow you to inject additional props into route elements at creation time.
95+
- Pass in a `render` handler to `<Router>` with the result of `applyRouterMiddleware`, using a middleware such as:
96+
```javascript
97+
extraProps => ({
98+
renderRouteComponent: (child) => React.cloneElement(child, extraProps)
99+
})
100+
```
95101
- Define a top-level component above `<Router>` or `<RouterContext>` that exports additional values via `getChildContext`, then access them via context from rendered components.
96102

97103

0 commit comments

Comments
 (0)