Access user data and authentication status.
A convenience hook that returns only user-related state and the refreshUser action, avoiding unnecessary re-renders from unrelated context changes.
refreshUser
{ user, isAuthenticated, isLoading, status, refreshUser }
function Greeting() { const { user, isAuthenticated } = useUser(); if (!isAuthenticated) return null; return <p>Welcome, {user?.name || user?.email}</p>;} Copy
function Greeting() { const { user, isAuthenticated } = useUser(); if (!isAuthenticated) return null; return <p>Welcome, {user?.name || user?.email}</p>;}
Access user data and authentication status.
A convenience hook that returns only user-related state and the
refreshUseraction, avoiding unnecessary re-renders from unrelated context changes.