Wasn't able to find a solution using React Router, but was able to accomplish this using the browser's history interface by calling:
window.history.replaceState(null, "New Page Title", "/pathname/goes/here")
You can learn more about .replaceState
here.
React Router's history.replace
won't always work
React Router's history.replace
method may or may not trigger a re-render depending on your app's route setup (e.g., you have a catch-all /*
route). It does not prevent a render by definition.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…