I would like to add an event listener to a navigate event in react router v6. I have not found anything to it. Is there such a feature?
Edit: When the event is handled, I want to prevent the navigation and route the user to another destination, which depends on where he is comming from.
You can useLocation() and useEffect().
const location = useLocation();
useEffect(() => {
console.log("url changed")
}, [location]);