#How can I reload a page on navigate?

1 messages · Page 1 of 1 (latest)

maiden sequoia
#

I am using useNavigate to programmatically navigate a user when a button is clicked or when a certain condition is met. The reason I want to reload the page to which the user will be redirected is because I want to disable their media devices.

formal pasture
#

I believe that’s a job for window.location.reload() to specifically reload the page. But for the purpose of media device disabling surely there’s a better way. You’d also be able to accomplish the reload by leaving react routers navigate and changing route with window.location.href (I think it’s href)

#

But useNavigste ties in closely with react router so it’s able to stop your browser from “loading” again when you navigate. If you calll the native api (window.location) it’s not integrated well with react router so it forces the user to “reload” on the new route