5

Using React Router, what's the best way of pushing a new entry to the history so it updates the URL, but without triggering a new route?

The Navigation.replaceWith() mixin method seems to do the opposite of what I need.

Artjom B.
  • 59,901
  • 24
  • 121
  • 211
evilcelery
  • 15,573
  • 8
  • 41
  • 54

1 Answers1

2

Not really familiar with React-Router's API, but you could use pure javascript to do that.

window.history.pushState({}, '', 'https://stackoverflow.com/new-url-here');

More answers here: Modify the URL without reloading the page

Community
  • 1
  • 1
Maktouch
  • 2,997
  • 19
  • 21