0

I am learning react-router for client-side routing in my basic webpage. I want to know how to refresh the browser once immediately after the route changes.

Is there a way to refresh the browser after the route changes using react-router? Please do comment for more clarity if needed.

Note: Please provide suggestions for scenarios where react-router v4 is not used and an older version of react-router is used. (Just curious...........XD)

MVG
  • 314
  • 1
  • 3
  • 17
  • Why would you need to refresh the browser? – Shubham Khatri Apr 20 '18 at 06:44
  • Just wanted to know. As part of learning, I am generating random numbers in each component when it loads up. When I manually refresh the page, a new number shows up in the component. So, I thought how to automatically refresh the browser as the component loads up. I was just curious...... – MVG Apr 20 '18 at 06:51
  • 1
    Its entirely possible to do all that using lifecycle methods and if you elaborate your use case with the code snippet, people might actually be able to help you better – Shubham Khatri Apr 20 '18 at 06:53

1 Answers1

0

I was also searching for programmatically updating react router and found the best anwser which covers all router versions.

hope you will find this useful

https://stackoverflow.com/a/31079244/8542218

to refresh the page you can simply pass '/' or your home(landing) page route.

Sandeep Kamble
  • 261
  • 3
  • 4