import React, { useContext } from "react"; import { AuthContext } from "../contexts/AuthContext"; const ProtectedPage: React.FC = () => { const { isAuthenticated, user, loading } = useContext(AuthContext); if (loading) { return

Loading...

; } if (!isAuthenticated || !user) { return (

Access Denied

You are not logged in.

); } return (

Protected Page

Welcome, {user.displayName}!

Your user ID is: {user.id}

); }; export default ProtectedPage;