Everytime I execute history.push("/path") the url changes to the correct path but the 404 PageNotFound component gets renderered.
history.push("/path")
Use react-router v5.2.0 and history v4.9.0 to make this work.
https://codesandbox.io/s/quizzical-dan-z3725
OR
Try using BrowserHistory https://reactrouter.com/web/example/basic
seems there is some issue with customHistory when we use different version