Skip to content
Alchemy Logo

useLogout

function useLogout(mutationArgs?): UseLogoutResult;

Defined in: account-kit/react/src/hooks/useLogout.ts:38

Provides a hook to log out a user, disconnecting the signer and triggering the disconnectAsync function. This will disconnect both EVM and Solana wallets.

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

ParameterTypeDescription

mutationArgs?

Partial<Omit<UseMutationOptions<void, Error, void, unknown>, "mutationFn" | "mutationKey">>

optional arguments to customize the mutation behavior

UseLogoutResult

an object containing the logout function, a boolean indicating if logout is in progress, and any error encountered during logout

Was this page helpful?