Skip to main content
It is unknown whether this package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers
It is unknown whether this package works with Cloudflare Workers
It is unknown whether this package works with Node.js
It is unknown whether this package works with Deno
It is unknown whether this package works with Bun
It is unknown whether this package works with Browsers
JSR Score
70%
Published
5 months ago (0.2.0)
function useAccounts
useAccounts(): UseAccountsReturnType

A hook to get accounts from Chrono browser extension with @tanstack/react-query.

Examples

Show accounts

import { useAccounts } from '@planetarium/chrono-sdk/hooks';

function App() {
  const { isLoading, isSuccess, data, error } = useAccounts();

  if (isLoading) {
     return <p>Loading accounts...</p>
  }

  if (!isSuccess) {
     return <p>Failed to get accounts: {error}</p>
  }

  const { accounts, isConnected } = data;

  if (!isConnected) {
     // Show connect button.
  }

  return (<div>
    {accounts.map(x => <p key={x.toString()}>{x.toString()}</p>)}
  </div>)
}

Return Type

UseAccountsReturnType

Add Package

deno add jsr:@planetarium/chrono-sdk

Import symbol

import { useAccounts } from "@planetarium/chrono-sdk/hooks";

---- OR ----

Import directly with a jsr specifier

import { useAccounts } from "jsr:@planetarium/chrono-sdk/hooks";

Add Package

npx jsr add @planetarium/chrono-sdk

Import symbol

import { useAccounts } from "@planetarium/chrono-sdk/hooks";

Add Package

yarn dlx jsr add @planetarium/chrono-sdk

Import symbol

import { useAccounts } from "@planetarium/chrono-sdk/hooks";

Add Package

pnpm dlx jsr add @planetarium/chrono-sdk

Import symbol

import { useAccounts } from "@planetarium/chrono-sdk/hooks";

Add Package

bunx jsr add @planetarium/chrono-sdk

Import symbol

import { useAccounts } from "@planetarium/chrono-sdk/hooks";