Render profile information
Display a signed-in user's name or contact details.
Clerk · Class
The User object represents the current user associated with a Clerk session. It provides core identity, contact, and metadata information.
The User object models the current session's user and exposes basic identity data, contact methods, and metadata. Access it through the framework's Clerk integration, then account for loading and signed-out states before reading its fields.
The current User object, or undefined while the session is loading, or null when no session is active.
import { useUser } from '@clerk/nextjs'
export default function Profile() {
const { user, isLoaded } = useUser()
if (!isLoaded) return <p>Loading…</p>
if (!user) return <p>Signed out</p>
return <p>Hello, {user.firstName ?? 'there'}!</p>
}Reads the currently signed-in user after Clerk finishes loading.
Display a signed-in user's name or contact details.
Use public metadata to customize application UI.
Inspect the current session's principal before showing protected content.
The User object represents the user associated with the current session. It contains basic information such as names, email addresses, phone numbers, and public, private, and unsafe metadata.
Follow-up: How do you distinguish loading from signed out? A loading user is undefined; after loading, no active session is represented by null.
Use the framework integration's user hook or object, wait until loading completes, and then check whether the value is present before accessing fields. This avoids treating an unresolved session as an anonymous user.
Follow-up: What should the UI render for each state? A loading indicator for undefined, signed-out content for null, and protected user content for a User object.
The object includes identity and contact information together with public, private, and unsafe metadata. Which fields are available depends on the resource type and the SDK surface being used.
Follow-up: Why separate metadata categories? They provide different visibility and trust boundaries, so application code should not expose or trust every category identically.
ClerkSessionUserResource