Docs

useClerk()

The useClerk() hook is a convenient way to access to the Clerk object, giving you the ability to build alternatives to any Clerk Component.

Warning

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.

useClerk() returns

The useClerk() hook returns the Clerk object, which includes all the methods and properties listed in the Clerk reference.

How to use the useClerk() hook

home.tsx
import { useClerk } from '@clerk/clerk-react'

export default function Home() {
  const clerk = useClerk()

  return <button onClick={() => clerk.openSignIn({})}>Sign in</button>
}

Feedback

What did you think of this content?

Last updated on