It modifies the browser history, so the URL won’t change, but the “location” object will, since it’s internal state got updated

As in the article, if you do const location = useLocation() in a component, this component *should* re-render since the browser location object has changed.

If this doesn’t happen, make sure you follow the setup instructions correctly by passing tthe same history object to both your <Router> component and your routerMiddleware .


Front-end ReactJS Developer —

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Aggelos Arvanitakis

Aggelos Arvanitakis

Front-end ReactJS Developer —

More from Medium

Ten Times Startups Spoke Out on Policy in the Last 10 Years

The Why #39: “Why do people buy lottery tickets despite the minuscule chance of winning?

Benjie Wimberly: More work awaits in America’s racial reckoning | Opinion

Metaverse: Good, Bad or Ugly?