From what I understand, with the replacement of history in react router v6, the implementation of useNavigate() and Navigate should achieve similar behavior. How could I implement the below to function similarly to achieve return to previous page before login:
useNavigate (https://reactrouter.com/en/v6.3.0/api#usenavigate):
const navigate = useNavigate();
useEffect(() => {
return navigate(-1, { replace: true });
});
Navigate component(https://reactrouter.com/en/v6.3.0/api#navigate):
<Navigate to="/home" replace state={{ from: location }} />;