Skip to Content
Clerk logo

Clerk Docs

Ctrl + K
Go to clerkstage.dev

useClerk()

The useClerk() hook provides access to the Clerk object, giving you the ability to build alternatives to any Clerk Component.

This is intended to be used for advanced use cases, like building a completely custom OAuth flow or as an escape hatch for getting access to the Clerk object.

Usage

pages/index.tsx
import { useClerk } from "@clerk/nextjs"; export default function Home() { const clerk = useClerk(); return <button onClick={() => clerk.openSignIn({})}>Sign in</button>; }
home.tsx
import { useClerk } from "@clerk/clerk-react"; export default function Home() { const clerk = useClerk(); return <button onClick={() => clerk.openSignIn({})}>Sign in</button>; }

What did you think of this content?

Clerk © 2024