---
title: "useConvexAction"
description: "Reference for the shared action composable."
canonical_url: "https://nuxt-convex.onmax.me/api-reference/use-convex-action"
---
# useConvexAction

> Reference for the shared action composable.

`useConvexAction` wraps a generated Convex action and exposes the same pending and error pattern as `useConvexMutation`.

## Import

```ts [Nuxt]
// Auto-imported. Also exported from '#convex'.
const { execute } = useConvexAction(api.tasks.summarize)
```

```ts [Vue]
import { useConvexAction } from 'vue-convex'
```

## Signature

```ts
function useConvexAction<Action extends FunctionReference<'action'>>(
  action: Action,
): {
  // `args` is optional when the action takes none
  execute: (...args: OptionalRestArgs<Action>) => Promise<FunctionReturnType<Action>>
  error: Ref<Error | null>
  isPending: ComputedRef<boolean>
}
```

## Return value

<table>
<thead>
  <tr>
    <th>
      Field
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Meaning
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        execute
      </code>
    </td>
    
    <td>
      <code>
        (args) => Promise<T>
      </code>
    </td>
    
    <td>
      Executes the action
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        error
      </code>
    </td>
    
    <td>
      <code>
        Ref<Error | null>
      </code>
    </td>
    
    <td>
      Latest action error
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        isPending
      </code>
    </td>
    
    <td>
      <code>
        ComputedRef<boolean>
      </code>
    </td>
    
    <td>
      <code>
        true
      </code>
      
       while one or more calls are in flight
    </td>
  </tr>
</tbody>
</table>

## Behavior

- Runs over the realtime client. Before it connects, and during SSR, `execute` rejects with `Convex realtime client is not connected`
- A failed call rejects and sets `error`
- Intended for non-transactional work, side effects, or orchestration
- Does not accept optimistic updates

## Related pages

- [Mutations & Actions](https://nuxt-convex.onmax.me/vue-guide/mutations-and-actions)
- [useConvexMutation](https://nuxt-convex.onmax.me/api-reference/use-convex-mutation)


## Sitemap

See the full [sitemap](https://nuxt-convex.onmax.me/sitemap.md) for all pages.
