import { Link, useLocation, useNavigate } from "react-router-dom";
I have to move previous location after login successfully but again and again it allow me to default url .
const Login = () => {
const location = useLocation();
let from = location.state?.from?.pathname || "/";
if (user) {
navigate(from, { replace: true });
}
I am expecting to get access previous location towhere i signout.
navigate(-1)
will give you the result you wanted.