If you’re using React Router v5 with a custom history object (<Router history={history}>
) and are experiencing issues like redirects not working properly or not rendering, it might be because of the version of the history
library you’re using.
React Router (react-router-dom
) 5.x works with history
4.x, I was using "react-router-dom": "^5.2.0"
with "history": "^5.0.0"
and my redirects were updating the url but not rendering the component or logging any errors in the browser console, it was a frustrating couple of hours before I stumbled onto the solution.
The issues were fixed by updating the history version to "history": "^4.10.1"
.
#react native