Is there a way to check the next location via React Router? I am not interested in using Prompt solution. My goal is to set some condition on component unmount like:
useEffect(() => {
return () => {
if(nextRoute !== '/something') {
resetData();
}
};
}, []);
Is there a way to have a knowledge what is the nextRoute
?