# useSendUserOperation | @account-kit/react

> Overview of the useSendUserOperation hook from @account-kit/react

> For the complete documentation index, see [llms.txt](/docs/llms.txt).

{/* This file is auto-generated by TypeDoc. Do not edit manually. */}

```ts
function useSendUserOperation<TEntryPointVersion, TAccount>(
  params,
): UseSendUserOperationResult<TEntryPointVersion, TAccount>;
```

Defined in: [account-kit/react/src/hooks/useSendUserOperation.ts:131](https://github.com/alchemyplatform/aa-sdk/blob/main/account-kit/react/src/hooks/useSendUserOperation.ts#L131)

A [hook](https://github.com/alchemyplatform/aa-sdk/blob/main/account-kit/react/src/hooks/useSendUserOperation.ts) that returns functions for sending user operations.
You can also optionally wait for a user operation to be mined and get the transaction hash before returning using `waitForTx`.
Like any method that takes a smart account client, throws an error if client undefined or is signer not authenticated.

## Example

```tsx twoslash
import React from "react";
import {
  useSendUserOperation,
  useSmartAccountClient,
} from "@account-kit/react";

function ComponentWithSendUserOperation() {
  const { client } = useSmartAccountClient({});

  const { sendUserOperation, isSendingUserOperation } = useSendUserOperation({
    client,
    // optional parameter that will wait for the transaction to be mined before returning
    waitForTxn: true,
    onSuccess: ({ hash, request }) => {
      // [optional] Do something with the hash and request
    },
    onError: (error) => {
      // [optional] Do something with the error
    },
    // [optional] ...additional mutationArgs
  });

  return (
    <div>
      <button
        onClick={() =>
          sendUserOperation({
            uo: {
              target: "0xTARGET_ADDRESS",
              data: "0x",
              value: 0n,
            },
          })
        }
        disabled={isSendingUserOperation}
      >
        {isSendingUserOperation ? "Sending..." : "Send UO"}
      </button>
    </div>
  );
}
```

## Type Parameters

<table>
  <thead>
    <tr>
      <th align="left">Type Parameter</th>
      <th align="left">Default type</th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        `TEntryPointVersion` *extends* keyof `EntryPointRegistryBase`\<`unknown`>
      </td>

      <td>
        ‐
      </td>
    </tr>

    <tr>
      <td>
        `TAccount` *extends* `SupportedAccounts`
      </td>

      <td>
        `SupportedAccounts`
      </td>
    </tr>

  </tbody>
</table>

## Parameters

<table>
  <thead>
    <tr>
      <th align="left">Parameter</th>
      <th align="left">Type</th>
      <th align="left">Description</th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        `params`
      </td>

      <td>
        [`UseSendUserOperationArgs`](../type-aliases/UseSendUserOperationArgs)\<`TEntryPointVersion`, `TAccount`>
      </td>

      <td>
        the parameters for the hook including the client, a flag to wait for tx mining, and mutation args. [ref](https://github.com/alchemyplatform/aa-sdk/blob/main/account-kit/react/src/hooks/useSendUserOperation.ts#L45)
      </td>
    </tr>

  </tbody>
</table>

## Returns

[`UseSendUserOperationResult`](../type-aliases/UseSendUserOperationResult)\<`TEntryPointVersion`, `TAccount`>

functions and state for sending UOs. [ref](https://github.com/alchemyplatform/aa-sdk/blob/main/account-kit/react/src/hooks/useSendUserOperation.ts#L53)