Skip to Content
You are viewing a beta version of Clerk Docs
Visit the latest docs
Clerk logo

Clerk Docs

Ctrl + K
Go to clerk.com

<ClerkLoaded>

The <ClerkLoaded> component guarantees that the Clerk object has loaded and will be available under window.Clerk. This allows you to wrap child components to access the Clerk object without the need to check it exists.

Usage

app/layout.tsx
import { ClerkProvider, ClerkLoaded, ClerkLoading } from '@clerk/nextjs' import './globals.css'; export default function RootLayout({ children, }: { children: React.ReactNode }) { return ( <ClerkProvider> <html lang="en"> <body> <ClerkLoaded> {children} </ClerkLoaded> </body> </html> </ClerkProvider> ) }

Once you have wrapped your app with <ClerkLoaded>, you can access the Clerk object without the need to check if it exists.

app/page.tsx
declare global { interface Window { Clerk: any; } } export default function Home() { return <div>This page uses Clerk {window.Clerk.version}; </div>; }

Last updated on April 11, 2024

What did you think of this content?

Clerk © 2024