Skip to content

useUser

A React hook that returns the current user information, either from an External Owned Account (EOA) or from the client store. It uses the Alchemy account context and synchronizes with external store updates. The best way to check if user is logged in for both smart account contract users and EOA.

If using smart contract account, returns address of the signer. If only using smart account contracts then you can use useSignerStatus or useAccount to see if the account is defined.

Import

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

Usage

import { useUser } from "@account-kit/react";
 
const user = useUser();

Returns

UseUserResult The user information, including address, orgId, userId, and type. If the user is not connected, it returns null. ref