> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/get-convex/convex-react-query/llms.txt
> Use this file to discover all available pages before exploring further.

# convexAction()

> Options factory function for calling a Convex action as a non-reactive TanStack Query.

`convexAction` creates a partial query options object for calling a Convex action through TanStack Query. Unlike `convexQuery`, actions are not reactive — they do not receive pushed updates from the Convex server and follow standard TanStack Query fetch semantics.

<Warning>
  Convex actions are **not reactive**. They will not receive live updates pushed from the server. Data is only refreshed via standard TanStack Query mechanisms such as manual refetch, window focus refetching, or stale time expiry. Actions cannot be used with `useSuspenseQuery`.
</Warning>

## Signature

```ts theme={null}
function convexAction<ConvexActionReference extends FunctionReference<"action">>(
  funcRef: ConvexActionReference,
  ...argsOrSkip: ConvexActionArgsOrSkip<ConvexActionReference>
): Pick<
  UseQueryOptions<FunctionReturnType<ConvexActionReference>, ...>,
  "queryKey" | "queryFn" | "staleTime" | "enabled"
>
```

## Parameters

<ParamField path="funcRef" type="FunctionReference<'action'>" required>
  The Convex action function reference, imported from `convex/_generated/api`.
</ParamField>

<ParamField path="args" type="FunctionArgs<typeof funcRef> | 'skip'">
  Arguments to pass to the action. Pass `"skip"` to disable the query — this sets `enabled: false` in the returned options. Can be omitted when the action takes no arguments.
</ParamField>

## Return value

Returns a partial query options object containing:

<ResponseField name="queryKey" type="[&#x22;convexAction&#x22;, funcRef, args]">
  A stable, serializable query key for the action call.
</ResponseField>

<ResponseField name="staleTime" type="number">
  Set to `Infinity` by default. Override this when you want the action result to periodically refetch.
</ResponseField>

<ResponseField name="enabled" type="boolean">
  Only present when `args` is `"skip"`. Set to `false` to prevent the action from running.
</ResponseField>

## Usage

**Basic action query:**

```tsx theme={null}
const { data, isPending, error } = useQuery(
  convexAction(api.weather.getSFWeather)
);
```

**With arguments:**

```tsx theme={null}
const { data } = useQuery(
  convexAction(api.myModule.myAction, { param: "value" })
);
```

**Conditional / skip:**

```tsx theme={null}
const { data } = useQuery(
  convexAction(api.weather.getSFWeather, isEnabled ? {} : "skip")
);
```

**Overriding `staleTime` for periodic refetch:**

```tsx theme={null}
const { data } = useQuery({
  ...convexAction(api.weather.getSFWeather),
  staleTime: 60_000,    // override Infinity; treat data as stale after 1 minute
  refetchInterval: 60_000,
});
```
