import { Navigate, Outlet, useLocation } from "react-router"; import { useAuth } from "./AuthContext"; export function RequireAuth() { const { user, loading } = useAuth(); const location = useLocation(); if (loading) return

Loading…

; if (!user) return ; return ; }