Expected When the user is on the /animals route, when they click the back button on the browser i want to redirect them back to another route instead of the previous route.
What's actually happening:
I am trying to redirect the url when the user clicks the back button on the browser, however i am having trouble with this where it is replacing the current location when the page loads on that route instead of replacing it when the user clicks the back button and it removes the pathname on top of that.
if (window.location.hash === '#/animals') {
return history.pushState({}, '', '/home');
}