> ## Documentation Index
> Fetch the complete documentation index at: https://docs.getpara.com/llms.txt
> Use this file to discover all available pages before exploring further.

# React Hooks

> State management and SDK interactions using Para's React hooks

Para's React hooks provide an intuitive way to manage wallet state, handle transactions, and interact with the Para SDK. These hooks are built on top of TanStack Query (React Query) for efficient data fetching and state management.

## Prerequisites

Before using Para's React hooks, ensure you have:

1. Set up the Para Modal in your application following one of our framework integration guides
2. Wrapped your application with the `ParaProvider`
3. Installed the required dependencies:

```bash theme={null}
npm install @getpara/react-sdk @tanstack/react-query --save-exact
```

## Provider Setup

To use Para's React hooks, wrap your application with `ParaProvider`:

```tsx theme={null}
import { ParaProvider } from "@getpara/react-sdk";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";

const queryClient = new QueryClient();

function App() {
  return (
    <QueryClientProvider client={queryClient}>
      <ParaProvider
        paraClientConfig={{
          apiKey: "beta_YOUR_API_KEY_HERE",
        }}>
        <YourApp />
      </ParaProvider>
    </QueryClientProvider>
  );
}
```

<Warning>
  `ParaProvider` renders an embedded `ParaModal` by default. Do not also render a separate `<ParaModal />` unless you set `config={{ disableEmbeddedModal: true }}` on the provider.
</Warning>

<Note>If you're using a legacy API key (one without an environment prefix) you must provide a value to the `paraClientConfig.environment`. You can retrieve your updated API key from the Para Developer Portal at [https://developer.getpara.com/](https://developer.getpara.com/)</Note>

## Quick Example

Here's a simple example using multiple hooks together:

```tsx theme={null}
import { useAccount, useWallet, useSignMessage, useModal } from "@getpara/react-sdk";

function WalletComponent() {
  const account = useAccount();
  const { data: wallet } = useWallet();
  const { signMessageAsync } = useSignMessage();
  const { openModal } = useModal();

  const handleSign = async () => {
    if (!wallet) return;

    const result = await signMessageAsync({
      messageBase64: Buffer.from("Hello Para!").toString("base64"),
    });

    console.log("Signature:", result.signature);
  };

  return (
    <div>
      {account?.isConnected ? (
        <button onClick={handleSign}>Sign Message</button>
      ) : (
        <button onClick={() => openModal()}>Connect Wallet</button>
      )}
    </div>
  );
}
```

## Hooks

<CardGroup cols={3}>
  <Card title="useAccount" description="Access account state and connection status" href="/v3/react/guides/hooks/use-account" icon="user" />

  <Card title="useWallet" description="Get current wallet information" href="/v3/react/guides/hooks/use-wallet" icon="wallet" />

  <Card title="useWalletBalance" description="Retrieve wallet balance" href="/v3/react/guides/hooks/use-wallet-balance" icon="coins" />
</CardGroup>

#### Authentication

<CardGroup cols={3}>
  <Card title="useSignUpOrLogIn" description="Start authentication flow" href="/v3/react/guides/hooks/use-sign-up-or-login" icon="right-to-bracket" />

  <Card title="useVerifyNewAccount" description="Verify new account" href="/v3/react/guides/hooks/use-verify-new-account" icon="check" />

  <Card title="useLogout" description="Log out current user" href="/v3/react/guides/hooks/use-logout" icon="right-from-bracket" />
</CardGroup>

#### Wallet Operations

<CardGroup cols={3}>
  <Card title="useSignMessage" description="Sign messages with wallet" href="/v3/react/guides/hooks/use-sign-message" icon="signature" />

  <Card title="useSignTransaction" description="Sign blockchain transactions" href="/v3/react/guides/hooks/use-sign-transaction" icon="file-contract" />

  <Card title="useCreateWallet" description="Create new wallet" href="/v3/react/guides/hooks/use-create-wallet" icon="plus" />
</CardGroup>

#### Session Management

<CardGroup cols={3}>
  <Card title="useKeepSessionAlive" description="Maintain active sessions" href="/v3/react/guides/hooks/use-keep-session-alive" icon="clock-rotate-left" />

  <Card title="useIssueJwt" description="Issue JWT tokens" href="/v3/react/guides/hooks/use-issue-jwt" icon="key" />
</CardGroup>

#### Utility Hooks

Utility hooks provide access to core functionality without React Query:

<CardGroup cols={3}>
  <Card title="useClient" description="Access Para client instance" href="/v3/react/guides/hooks/use-client" icon="cube" />

  <Card title="useModal" description="Control Para modal" href="/v3/react/guides/hooks/use-modal" icon="window-restore" />

  <Card title="useWalletState" description="Manage selected wallet" href="/v3/react/guides/hooks/use-wallet-state" icon="hand-pointer" />
</CardGroup>
