useClerk()
The useClerk()
hook provides access to the 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 giving access to lower-level APIs.
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>; }