Skip to content

useAddPasskey

A custom hook to handle the addition of a passkey, which includes executing a mutation with optional parameters.

Import

import { useAddPasskey } from "@account-kit/react";

Usage

import { useAddPasskey } from "@account-kit/react";
 
const { addPasskey, isAddingPasskey, error } = useAddPasskey({
  // these are optional
  onSuccess: () => {
    // do something on success
  },
  onError: (error) => console.error(error),
});

Parameters

mutationArgs

UseAddPasskeyMutationArgs Optional arguments for the mutation used for adding a passkey

Returns

UseAddPasskeyResult An object containing the addPasskey function, a boolean isAddingPasskey to track the mutation status, and any error encountered