The problem is that you create your own history object and pass it to the router. However, React Router v4 already provides this object for you through this.props . (Importing a router is irrelevant)
componentDidMount() { this.props.history.listen((location, action) => console.log('History changed!', location, action)); }
You may need to overlay your application a bit, as shown below, and put this componentDidMount method in MyApp.jsx , rather than right at the top level.
<Provider store={store}> <BrowserRouter> <MyApp/> </BrowserRouter> </Provider>
(Or use NativeRouter instead of BrowserRouter if you are doing React Native)
Micros
source share