Skip to content
This repository was archived by the owner on Oct 26, 2018. It is now read-only.

Commit 50faa62

Browse files
committed
Add a note warning about reading from store.
1 parent cb9d6b6 commit 50faa62

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ function mapStateToProps(state, ownProps) {
9292
}
9393
```
9494

95+
You should not read the location state directly from the Redux store. This is because React Router operates asynchronously (to handle things such as dynamically-loaded components) and your component tree may not yet be updated in sync with your Redux state. You should rely on the props passed by React Router, as they are only updated after it has processed all asynchronous code.
96+
9597
#### What if I want to issue navigation events via Redux actions?
9698

9799
React Router provides singleton versions of history (`browserHistory` and `hashHistory`) that you can import and use from anywhere in your application. However, if you prefer Redux style actions, the library also provides a set of action creators and a middleware to capture them and redirect them to your history instance.

0 commit comments

Comments
 (0)