Skip to content

Commit

Permalink
Merge pull request #3214 from taion/document-onChange
Browse files Browse the repository at this point in the history
Document new onChange hook
  • Loading branch information
knowbody committed Mar 21, 2016
2 parents 41e6d8d + 9aba109 commit 88c6fb8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 4 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
## [HEAD]
## [HEAD] \(v2.1.0\)
> Unreleased
- **Feature:** Add support for `onChange` hook on routes ([#3108])

[HEAD]: https://github.com/reactjs/react-router/compare/latest...HEAD
[#3108]: https://github.com/reactjs/react-router/pull/3108

## [v2.0.1]
> March 9, 2016
Expand Down
5 changes: 5 additions & 0 deletions docs/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,11 @@ Called when a route is about to be entered. It provides the next router state an

If `callback` is listed as a 3rd argument, this hook will run asynchronously, and the transition will block until `callback` is called.

##### `onChange(prevState, nextState, replace, callback?)`
Called on routes when the location changes, but the route itself neither enters or leaves. For example, this will be called when a route's children change, or when the location query changes. It provides the previous router state, the next router state, and a function to redirect to another path. `this` will be the route instance that triggered the hook.

If `callback` is listed as a 4th argument, this hook will run asynchronously, and the transition will block until `callback` is called.

##### `onLeave()`
Called when a route is about to be exited.

Expand Down

0 comments on commit 88c6fb8

Please sign in to comment.