Skip to content

useLogout

Provides a hook to log out a user, disconnecting the signer and triggering the disconnectAsync function.

Import

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

Usage

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

Parameters

mutationArgs

UseLogoutMutationArgs optional arguments to customize the mutation behavior

Returns

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