From the docs:
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.
The correct way is in the docs, but you can only do that in route components (those that you put in <Route path='/' component={Component} />).
I normally pass down the location property if I want to access it in some inner component.