---
title: "useConvexQueries"
description: "Reference for subscribing to a keyed set of Convex queries at once."
canonical_url: "https://nuxt-convex.onmax.me/api-reference/use-convex-queries"
---
# useConvexQueries

> Reference for subscribing to a keyed set of Convex queries at once.

`useConvexQueries` subscribes to a record of queries and keeps the subscriptions in sync as the record changes. Use it when the number of queries isn't known up front, such as one query per item of a list.

## Import

```ts [Nuxt]
// Auto-imported. Also exported from '#convex'.
const { data, errors } = useConvexQueries(queries)
```

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

## Signature

```ts
interface QueryEntry<Query extends FunctionReference<'query'> = FunctionReference<'query'>> {
  query: Query
  args: FunctionArgs<Query> | 'skip'
}

function useConvexQueries<T extends Record<string, QueryEntry>>(
  queries: MaybeRefOrGetter<T>,
): {
  data: Readonly<Ref<{ [K in keyof T]?: FunctionReturnType<T[K]['query']> }>>
  errors: Readonly<Ref<{ [K in keyof T]?: Error | ConvexError<Value> | null }>>
}
```

## Example

```vue [app/components/ProjectTotals.vue]
<script setup lang="ts">
import { api } from '#convex/api'

const props = defineProps<{ projectIds: string[] }>()

const { data } = useConvexQueries(() => Object.fromEntries(
  props.projectIds.map(id => [id, { query: api.projects.total, args: { id } }]),
))
</script>
```

## Behavior

- Client only. It isn't awaitable, doesn't run during SSR, and every entry is `undefined` in the server render. For server-rendered data, use one awaited `useConvexQuery` per query, or a query that returns everything at once.
- Adds, removes and updates subscriptions as the record changes. Entries whose args are deep-equal keep their subscription.
- Supports `'skip'` per entry. A skipped entry is `undefined` with a `null` error.
- Cleans up every subscription when the scope is disposed.

## Related pages

- [useConvexQuery](https://nuxt-convex.onmax.me/api-reference/use-convex-query)
- [SSR & Hydration](https://nuxt-convex.onmax.me/nuxt-module/ssr-and-hydration)


## Sitemap

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