import { useAtomValue } from "jotai"; import type { ReactNode } from "react"; import { Redirect } from "wouter"; import { authLoadingAtom, isLoggedInAtom } from "../atoms"; interface Props { children: ReactNode; } export function ProtectedRoute({ children }: Props) { const isLoggedIn = useAtomValue(isLoggedInAtom); const isLoading = useAtomValue(authLoadingAtom); if (isLoading) { return (