For what it's worth this is for react-router-dom v5.2.0.
I used to be able to easily override the back button link with the following code:
const MyLink = () => ({
<Link
to={{
pathname: 'go-somewhere',
state: { previousPath: 'override-previous-path'
}}
>
Go Somewhere
</Link>
})
By setting previousPath to whatever I would like to override to, it would override whatever I had visited previously. However, now that simply seemed to have stopped working one day.
Looking at the docs the to prop does not seem to have been changed, but the location has. Is it the previousPath state property that is incorrect?
Is there still a way to override the back link through the Link component?