<!--
title: Vue example correctness
domain: app-frameworks
topic: Vue
language: Markdown
source: tanstack/query
updated: 2025-11-26
url: https://awesomereviewers.com/reviewers/query-vue-example-correctness/
-->

When writing Vue (including Nuxt) code snippets or API docs, ensure the example is correct for the shapes the API truly supports and for the Nuxt/Vue environment.

- For reactive inputs, don’t restrict types to a single form (e.g., only `Ref`). If the API accepts reactive values *and* getters/computed, type it accordingly (e.g., `MaybeRefOrGetter`) and normalize when you need an actual value.
- For Nuxt 3 snippets, import composables/helpers from the correct alias used by Nuxt auto-imports (typically `#imports`), so the snippet works when copied.

Example (typing + normalization for reactive inputs):
```ts
import { computed, type MaybeRefOrGetter, type Ref } from 'vue'
import { toValue } from 'vue'

function useTodos(todoId: MaybeRefOrGetter<string>) {
  const normalizedId: Ref<string> = computed(() => toValue(todoId))
  // ...use normalizedId.value where a plain string is needed
}
```

Nuxt 3 import alias (plugin/snippet correctness):
```ts
import { defineNuxtPlugin, useState } from '#imports'
```

This keeps docs precise and copy-pastable rather than only “almost correct” for real-world reactive inputs or Nuxt runtime resolution.
