---
title: "ConvexQuery"
description: "Reference for the Nuxt renderless component that wraps useConvexQuery."
canonical_url: "https://nuxt-convex.onmax.me/api-reference/convex-query"
---
# ConvexQuery

> Reference for the Nuxt renderless component that wraps useConvexQuery.

`ConvexQuery` is a Nuxt-only renderless component that renders query states through slots. Like any Nuxt component, it's auto-imported where you use it.

## Example

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

<template>
  <ConvexQuery :query="api.tasks.list">
    <template #loading>
      Loading tasks...
    </template>

    <template #error="{ error }">
      {{ error.message }}
    </template>

    <template #empty>
      No tasks yet.
    </template>

    <template #default="{ data }">
      <ul>
        <li v-for="task in data" :key="task._id">
          {{ task.title }}
        </li>
      </ul>
    </template>
  </ConvexQuery>
</template>
```

## Props

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

<tbody>
  <tr>
    <td>
      <code>
        query
      </code>
    </td>
    
    <td>
      <code>
        FunctionReference<'query'>
      </code>
    </td>
    
    <td>
      Query reference
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        args
      </code>
    </td>
    
    <td>
      <code>
        FunctionArgs<Query> | 'skip'
      </code>
    </td>
    
    <td>
      Query arguments, reactive. Defaults to <code>
        {}
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        options
      </code>
    </td>
    
    <td>
      <code>
        UseConvexQueryOptions
      </code>
    </td>
    
    <td>
      Same options accepted by <code>
        useConvexQuery
      </code>
      
      , read once
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        suspense
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      Waits for the first result before rendering on the client too
    </td>
  </tr>
</tbody>
</table>

## Slots

- `loading`
- `error`
- `empty`
- `default`

## Behavior

- Uses `useConvexQuery` internally
- On the server, waits for the first result (unless `options.server` is `false`) and hydrates it, so the client renders the same slot without a loading flash
- A failing query renders the `error` slot on the server and the client; it never fails the request
- Treats `undefined`, `null` and an empty array as empty states, and a skipped query as empty

## Related pages

- [useConvexQuery](https://nuxt-convex.onmax.me/api-reference/use-convex-query)


## Sitemap

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