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.tsximport { useClerk } from "@clerk/nextjs"; export default function Home() { const clerk = useClerk(); return <button onClick={() => clerk.openSignIn({})}>Sign in</button>; }
home.tsximport { useClerk } from "@clerk/clerk-react"; export default function Home() { const clerk = useClerk(); return <button onClick={() => clerk.openSignIn({})}>Sign in</button>; }