Skip to content

Commit 49c9ca1

Browse files
committed
Update docs and changelog for release [ci skip]
1 parent 69b1632 commit 49c9ca1

File tree

2 files changed

+33
-5
lines changed

2 files changed

+33
-5
lines changed

CHANGES.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
## [v2.7.0]
2+
> Aug 20, 2016
3+
4+
- **Feature:** Support `router` as a prop on `withRouter`-wrapped components for overriding the router object from context ([#3729])
5+
- **Feature:** Add `withRef` option to `withRouter` that enables `getWrappedInstance` ([#3735], [#3740])
6+
- **Bugfix:** Warn on invalid router middlewares ([#3717])
7+
8+
[v2.7.0]: https://github.com/reactjs/react-router/compare/v2.6.1...v2.7.0
9+
[#3717]: https://github.com/reactjs/react-router/pull/3717
10+
[#3729]: https://github.com/reactjs/react-router/pull/3729
11+
[#3735]: https://github.com/reactjs/react-router/pull/3735
12+
[#3740]: https://github.com/reactjs/react-router/pull/3740
13+
14+
115
## [v2.6.1]
216
> Jul 29, 2016
317

docs/API.md

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
- [`<Router>`](#router)
55
- [`<Link>`](#link)
66
- [`<IndexLink>`](#indexlink)
7-
- [`withRouter`](#withroutercomponent)
7+
- [`withRouter`](#withroutercomponent-options)
88
- [`<RouterContext>`](#routercontext)
99
- [`context.router`](#contextrouter)
1010
- `<RoutingContext>` (deprecated, use `<RouterContext>`)
@@ -157,8 +157,22 @@ Given a route like `<Route path="/users/:userId" />`:
157157
### `<IndexLink>`
158158
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.
159159

160-
### `withRouter(component)`
161-
A HoC (higher-order component) that wraps another component to provide `this.props.router`. Pass in your component and it will return the wrapped component.
160+
### `withRouter(Component, [options])`
161+
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+
163+
You can explicit specify `router` as a prop to the wrapper component to override the router object from context.
164+
165+
#### Options
166+
167+
##### `withRef`
168+
If `true`, the wrapper component attaches a ref to the wrapped component, which can then be accessed via `getWrappedInstance`.
169+
170+
```jsx
171+
const WrapperComponent = withRouter(MyComponent, { withRef: true })
172+
173+
// Given a `wrapperInstance` that is of type `WrapperComponent`:
174+
const myInstance = wrapperInstance.getWrappedInstance()
175+
```
162176

163177
### `<RouterContext>`
164178
A `<RouterContext>` renders the component tree for a given router state. Its used by `<Router>` but also useful for server rendering and integrating in brownfield development.
@@ -621,7 +635,7 @@ For more details, please see the [histories guide](/docs/guides/Histories.md).
621635
`hashHistory` uses URL hashes, along with a query key to keep track of state. `hashHistory` requires no additional server configuration, but is generally less preferred than `browserHistory`.
622636

623637

624-
### `createMemoryHistory(options)`
638+
### `createMemoryHistory([options])`
625639
`createMemoryHistory` creates an in-memory `history` object that does not interact with the browser URL. This is useful for when you need to customize the `history` object used for server-side rendering, for automated testing, or for when you do not want to manipulate the browser URL, such as when your application is embedded in an `<iframe>`.
626640

627641

@@ -644,7 +658,7 @@ const history = useRouterHistory(createHashHistory)({ queryKey: false })
644658

645659
## Utilities
646660

647-
### `match({ routes, location, [history], ...options }, cb)`
661+
### `match({ routes, location, [history], [...options] }, cb)`
648662

649663
This function is to be used for server-side rendering. It matches a set of routes to a location, without rendering, and calls a `callback(error, redirectLocation, renderProps)` when it's done.
650664

0 commit comments

Comments
 (0)