PollarPollarDemo

Products

AuthenticationWalletTransactions

Integrations

KYCSoonRampNewSwapNewEarnNew

Wallet Adapters

Stellar Wallets KitPrivyNewCosmos WalletNew

Adapters

Trustless Work

Built with Pollar

LumenWipeNew
LoginLogoutSessions

Logout

Sign the current user out. logout() revokes this device's session server-side and clears local storage; pass { everywhere: true } to revoke every device. The same call backs both @pollar/core and @pollar/react.

logout() from usePollar() revokes the session and clears local state; the reactive isAuthenticated flips to false and your UI re-renders.

logout() revokes the current session and clears local state — isAuthenticated flips to false.

Hook & values used

All of these come from the usePollar() hook — the react layer built on top of getClient().

  • usePollar()hook

    params: No arguments. Call it at the top level of a component — it reads React context, so it must run during render.

    returns: PollarContextValue — the whole SDK surface: reactive state values, modal openers, and getClient() to drop down to core.

  • logout()sync

    params: No arguments — wraps client.logout(). Revokes the current session and clears local state.

    returns: void — nothing to await; isAuthenticated flips to false and dependent UI re-renders.

  • isAuthenticatedreactive value

    params: Not a function — a boolean read from usePollar(). Gate the sign-out button on it (nothing to revoke when already false).

    returns: Re-renders your component when it flips to false after logout.

@pollar/react— hooks & components
import { usePollar } from '@pollar/react';

export function LogoutButton() {
  const { logout, isAuthenticated } = usePollar();

  // logout() revokes the current session and clears local state;
  // usePollar()'s isAuthenticated flips to false and the UI re-renders.
  return (
    <button onClick={logout} disabled={!isAuthenticated}>
      Sign out
    </button>
  );
}