useClerk()
The useClerk() hook provides access to the object, allowing you to build alternatives to any Clerk Component.
Returns
— The useClerk() hook returns the Clerk object, which includes all the methods and properties listed in the .
Example
The following example uses the useClerk() hook to access the clerk object. The clerk object is used to call the method to open the sign-in modal.
import { useClerk } from "@clerk/clerk-react";
export default function Home() {
const clerk = useClerk();
return <button onClick={() => clerk.openSignIn({})}>Sign in</button>;
}"use client";
import { useClerk } from "@clerk/nextjs";
export default function HomePage() {
const clerk = useClerk();
return <button onClick={() => clerk.openSignIn({})}>Sign in</button>;
}Feedback
Last updated on