Sometimes, we want to force a React Router to load a page, even if we’re already on that page.
In this article, we’ll look at how to force a React Router to load a page, even if we’re already on that page.
How to force a React Router to load a page, even if we’re already on that page?
To force a React Router to load a page, even if we’re already on that page, we can add the forceRefresh prop to the BrowserRouter component.
For instance, we write
<BrowserRouter forceRefresh>...</BrowserRouter>;
to add the forceRefresh prop to BrowserRouter.
Conclusion
To force a React Router to load a page, even if we’re already on that page, we can add the forceRefresh prop to the BrowserRouter component.