This hook determines whether a user is logged in or not. The hook needs to be initialized within a child of DynamicContextProvider.


import { useIsLoggedIn } from '@dynamic-labs/sdk-react-core';

const MyComponent = () => {
  const isLoggedIn = useIsLoggedIn();

  return (
      {isLoggedIn ? (
        <p>You are logged in!</p>
      ) : (
        <p>Please log in to continue.</p>

export default MyComponent;

Return Value

The hook returns a boolean value indicating whether the user is logged in or not.


The hook first checks if the user object exists or if the authMode is ‘connect-only’ and a primaryWallet exists. If either of these conditions is true, the user is considered logged in.

Next, it checks the user should have a primaryWallet due to embedded wallets being enabled. If the user should have a promaryWallet and it doesn’t exist, the user is not considered logged in, otherwise, they are considered logged in.