Skip to content

Commit d69f1c1

Browse files
committed
Explain getting router state in action creators
1 parent 911073a commit d69f1c1

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

docs/guides/flux.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,21 @@ To avoid this, you can do one of three things:
117117
```
118118

119119

120+
Accessing route and params from action creators
121+
---------------------------------
122+
123+
You can create your own `RouterStore` and fire an action in `run` callback:
124+
125+
```js
126+
Router.run(routes, (Handler, state) => {
127+
ActionCreators.changeRoute({ state });
128+
React.render(<Handler/>, document.body);
129+
});
130+
```
131+
132+
Let `RouterStore` keep router state and add a public method to obtain it.
133+
This way your action creators and other stores can learn about current router state.
134+
120135
Handling route changes as actions
121136
---------------------------------
122137

0 commit comments

Comments
 (0)