connect and withRouter issue
You can do it in two ways,
Proper Way:
withRouter(connect(mapStateToProps, mapDispatchToAction)(App));
with this, you will able to get withRouter props like history, match etc.. in mapStateToProps.
2nd way:
connect(mapStateToProps, mapDispatchToAction)(withRouter(App));
using this, you won't be able to get the withRouter props
You can use it with the method compose
from redux library.
export default compose(
withRouter,
connect(mapStateToProps, mapDispatchToProps)
)(App);
Could you refer to this https://reacttraining.com/react-router/core/api/withRouter, it clearly says that it doesn't work the other way around