> For the complete documentation index, see [llms.txt](https://docs.intents.aurora.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.intents.aurora.dev/intents-connect/intents-connect-sdk/typescript-sdk/react.md).

# React

IntentsConnectProvider and useExecution, the runner as React state.

`@aurora-is-near/intents-connect/react` wraps the runner in a provider and a hook. The hook re-renders on every phase or status change, so your UI is just a view of its state.

```tsx
import { createIntentsConnectApi } from '@aurora-is-near/intents-connect';
import {
  IntentsConnectProvider,
  useExecution,
} from '@aurora-is-near/intents-connect/react';

const api = createIntentsConnectApi({ baseUrl, apiKeyProxyUrl });

export function App() {
  const { wallet } = useIntentsConnectWallet(); // from intents-connect-wallet

  return (
    <IntentsConnectProvider api={api} wallet={wallet}>
      <Deposit />
    </IntentsConnectProvider>
  );
}

function Deposit() {
  const exec = useExecution({ onEvent: (e) => console.log(e) });

  return (
    <>
      <button disabled={exec.isBusy} onClick={() => exec.run(plan)}>
        {exec.phase === 'idle' ? 'Deposit' : exec.phase}
      </button>

      {/* only ever set after the signature, so the order can't be wrong */}
      {exec.depositAddress && <Qr value={exec.depositAddress} memo={exec.depositMemo} />}

      {exec.recovery?.kind === 'retry-transfer' && (
        <button onClick={() => exec.retryDeposit()}>Retry deposit</button>
      )}
    </>
  );
}
```

## `IntentsConnectProvider`

| Prop                                                                            | Type                      | Notes                                                                                                             |
| ------------------------------------------------------------------------------- | ------------------------- | ----------------------------------------------------------------------------------------------------------------- |
| `api`                                                                           | `IntentsConnectApi`       | From `createIntentsConnectApi`. Safe to create inline                                                             |
| `wallet`                                                                        | `WalletConnector \| null` | `null` while disconnected. See [Wallet integrations](/intents-connect/intents-connect-sdk/wallet-integrations.md) |
| `plugins`, `pluginOptions`, `makeTransfer`                                      | optional                  | Deposit transfer, if the wallet has no `makeTransfer`                                                             |
| `pollIntervalMs`, `maxPollAttempts`, `logger`, `autoCancelOnSignatureRejection` | optional                  | Same as the `createExecutionRunner` options                                                                       |

## `useExecution()`

**State**

| Field                                                        | Meaning                                                                                                                            |
| ------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------- |
| `phase`, `status`                                            | Client phase and server status ([Lifecycle & errors](/intents-connect/intents-connect-sdk/typescript-sdk/lifecycle-and-errors.md)) |
| `isBusy`                                                     | An execution is in flight. Disable inputs and tabs                                                                                 |
| `executionId`, `execution`                                   | The current execution                                                                                                              |
| `networkFee`, `spendable`                                    | Fee in the destination asset, and what's left to spend                                                                             |
| `depositAddress`, `depositMemo`, `deadline`, `depositTxHash` | Deposit leg                                                                                                                        |
| `hasSubmittedSignature`, `isCancelling`                      | Progress flags                                                                                                                     |
| `error`, `recovery`                                          | Last error, and the suggested action (`resume-or-cancel` / `retry-transfer`)                                                       |

**Methods:** `preview`, `run`, `previewSteps`, `runSteps`, `resume`, `retryDeposit`, `cancel`. All are async. Without a connected wallet they reject with `WALLET_NOT_CONNECTED` and don't throw.

## Notes

* **One runner per hook call.** Two `useExecution()` calls give two independent runners.
* **Wallet changes:** the runner is rebuilt when the wallet's address or signing standard changes. If the wallet changes mid-run, `resume()` the execution from the new runner.
* **StrictMode-safe:** a double mount doesn't dispose a live runner.

## Next

* [Examples](/intents-connect/intents-connect-sdk/examples.md): full React integrations
* [Wallet integrations](/intents-connect/intents-connect-sdk/wallet-integrations.md): where `wallet` comes from


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.intents.aurora.dev/intents-connect/intents-connect-sdk/typescript-sdk/react.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
