Where am I wrong?
useEffect(() => {
if (user) {
navigate(
{
pathname: `/dashboard`,
}
);
}
}, []);
const navigate = useNavigate();
const queries = new URLSearchParams(navigate.location.search);
After fetching query I perform queries.get which is again undefined, why?
Assuming you have an url like this :
localhost:3000?param1=value1, You are supposed to do something like that to get the value from the url parameter:However, I would rather recommand to use the hook
useParams, so you can get directly the param like this:Assuming that the route to this component would be: