locationBeforeTransitions null initially
I am writing an isomorphic app with react and using react-router-redux. I am doing following to sync store with browserHistory on client rendering, but on initial load, locationBeforeTransitions is null.
const history = syncHistoryWithStore(browserHistory, store);
...
<Router routes={ routes } history={ history } />
Should I fire LOCATION_CHANGE on server side manually to populate initial locationBeforeTransitions?
https://github.com/reactjs/react-router-redux#how-do-i-access-router-state-in-a-container-component
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.