javascript - react-router V4 BrowserRouter page refresh problem?
PHP中文网
PHP中文网 2017-07-05 10:50:48
0
1
1134

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);

PHP中文网
PHP中文网

认证0级讲师

reply all(1)
大家讲道理

forceRefresh is false only to ensure that the page is not refreshed as a whole

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template