Skip to content

Commit

Permalink
Explain getting router state in action creators
Browse files Browse the repository at this point in the history
  • Loading branch information
gaearon committed Feb 12, 2015
1 parent 911073a commit d69f1c1
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions docs/guides/flux.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,21 @@ To avoid this, you can do one of three things:
```


Accessing route and params from action creators
---------------------------------

You can create your own `RouterStore` and fire an action in `run` callback:

```js
Router.run(routes, (Handler, state) => {
ActionCreators.changeRoute({ state });
React.render(<Handler/>, document.body);
});
```

Let `RouterStore` keep router state and add a public method to obtain it.
This way your action creators and other stores can learn about current router state.

Handling route changes as actions
---------------------------------

Expand Down

0 comments on commit d69f1c1

Please sign in to comment.