The picture below shows the explanation of the BrowserRouter->forceRefresh attribute in the official document. However, if forceRefresh is set to false, the page is still refreshed and the previous state cannot be shared through react-redux. It is ok to replace BrowserRouter with HashRouter. , looking for answers?
I found the answer, it’s a question about my understanding of this thing!
I thought that just modifying window.history can directly change the rendering of React. In fact, this is not the case. react-router has its own history and needs to be operated through its own history; modify the window directly. .history does not cause react to re-render, but directly refreshes the page (an illusion caused by configuring HTML5 History mode);
forceRefresh is false only to ensure that the page is not refreshed as a whole