Downgrade your “history” version or simply remove it because the correct version will be automatically added by “react-router-dom”.
There is already an open issue about the same:
https://github.com/ReactTraining/history/issues/804
Which says React Router (mainly history.push
and Redirect
) is not working properly with latest (v5) version of history. But it is working perfectly with v4 of history.
For example, this should work:
"history": "^4.10.1",
"react-router-dom": "^5.2.0",