kaxa
kaxa
SSolidJS
Created by kaxa on 3/29/2024 in #support
Can't find replace attribute on <Navigate />
This is basically my code, I am trying to check if the user is authenticated, if not then redirect to login page.
export const ProtectedRoute: ParentComponent = (props) => {
const { authed } = useAuth();

return authed() ? (
props.children
) : (
<Navigate href={"/login"} state={{ from: location }} />
);
};
export const ProtectedRoute: ParentComponent = (props) => {
const { authed } = useAuth();

return authed() ? (
props.children
) : (
<Navigate href={"/login"} state={{ from: location }} />
);
};
However, the problem is, I can't set replace attribute to <Navigate /> component. is there any other way to achieve same thing with or without <Navigate />
21 replies