React router history.push falls back to 404 route

后端 未结 1 1687
独厮守ぢ
独厮守ぢ 2021-01-27 21:14

Everytime I execute history.push("/path") the url changes to the correct path but the 404 PageNotFound component gets renderered.



        
1条回答
  •  有刺的猬
    2021-01-27 22:02

    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

    0 讨论(0)
提交回复
热议问题