Is there a built-in way in react-router-dom v6, to go back to the previous page, BUT in case the previous page is out of the context of the application, to route to the root and to thus not out of the application.
Example: I surf to a www.thing.com/thingy
from www.google.com
, this page (www.thing.com/thingy
) has a go back
button on it => when I click on the go back button => I am redirected to www.google.com
instead of the wanted behaviour a redirect to www.thing.com
.
Mockup of an example page.
I have tried several implementations and searched through the documentation but couldn't find a built-in way to resolve this. As far as I can see there isn't a way. I can however make something custom to resolve my issue if its not.