If found an approach that i do not like that much but it works
So if you want to return to the previous page using react router v6 you can do the following
import { useNavigate } from 'react-router-dom';
const Component = () => {
const navigate = useNavigate()
return(
<div>
<button onClick={() => navigate(-1)}
</div>
)
}
Hope someone found it helpful.
Lautaro
Top comments (0)