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]);`
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.