Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.replyke.com/llms.txt

Use this file to discover all available pages before exploring further.

Overview

useAccounts returns the list of all stored accounts and the currently active account. Use it to render an account switcher or display the signed-in user’s identity.

Usage Example

import { useAccounts } from "@replyke/react-js";

function AccountSummaryBar() {
  const { accounts, activeAccount, accountCount } = useAccounts();

  return (
    <div>
      <p>Signed in as: {activeAccount?.name ?? activeAccount?.email ?? "Guest"}</p>
      <p>Total accounts: {accountCount}</p>
      <ul>
        {accounts.map((account) => (
          <li key={account.id}>{account.name ?? account.email}</li>
        ))}
      </ul>
    </div>
  );
}

Returns

accounts
AccountSummary[]
Array of all stored accounts, derived from the accounts map in Redux state.
activeAccount
AccountSummary | null
The account currently marked as active, or null if no session is active.
accountCount
number
Total number of stored accounts.

AccountSummary Type

PropertyTypeDescription
idstringUser ID
namestring | nullDisplay name
emailstring | nullEmail address
avatarstring | nullAvatar URL

Integration Guide

For multi-account integration guidance, see Multi-Account.