I am using react router v6. When I am on detail page and i´ll press arrow in chrome go on prev page it doesnt go on prev page but prev prev page. I checked history by long press on arrow back and the page I need is not there. How can i add that page to the history?
On the detail page i navigate from main page with navigate(‘detailPage/key’).
Edit: In detail page i did something like this, but then is not detail page in history.
useEffect(() => {
return () => navigate('/mainPage');
}, [navigate]);`
>Solution :
For react-router-v6
import { Link } from 'react-router-dom';
This ‘/mainPage’ Page should be declared in App.js as a route.
<Link to='/mainPage'><button>Go Main Page</button></Link>
You can check this link :https://github.com/remix-run/react-router/discussions/8465