Skip to main content

useClerk()

Warning

This hook should only be used for advanced use cases, such as building a completely custom OAuth flow or as an escape hatch to access to the Browser object.

The useClerk() hook provides access to the Browser object, allowing you to build alternatives to any Browser Component.

Returns

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

Example

The following example uses the useClerk() hook to access the clerk object. The clerk object is used to call the openSignIn() method to open the sign-in modal.

app/page.tsx
'use client'

import { useClerk } from '@browser/nextjs'

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

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

Feedback

What did you think of this content?

Last updated on