@tanstack/vue-query

Hooks for managing, caching and syncing asynchronous and remote data in Vue
19,223,180 50,490
Install
npm install @tanstack/vue-query
Latest Version:5.105.0
Vue:2 · 3
License:MIT
Last Updated:Oct 27, 2026
Links: GitHub  ·  npm
Maintainer: tannerlinsley
TanStack Vue Query
[![Vue Query logo](https://raw.githubusercontent.com/TanStack/query/main/packages/vue-query/media/vue-query.png)](https://github.com/TanStack/query/tree/main/packages/vue-query)

npm version npm license bundle size npm

Vue Query

Hooks for fetching, caching and updating asynchronous data in Vue.

Support for Vue 2.x via vue-demi

Documentation

Visit https://tanstack.com/query/latest/docs/vue/overview

Quick Features

  • Transport/protocol/backend agnostic data fetching (REST, GraphQL, promises, whatever!)
  • Auto Caching + Refetching (stale-while-revalidate, Window Refocus, Polling/Realtime)
  • Parallel + Dependent Queries
  • Mutations + Reactive Query Refetching
  • Multi-layer Cache + Automatic Garbage Collection
  • Paginated + Cursor-based Queries
  • Load-More + Infinite Scroll Queries w/ Scroll Recovery
  • Request Cancellation
  • (experimental) Suspense + Fetch-As-You-Render Query Prefetching
  • (experimental) SSR support
  • Dedicated Devtools
  • npm bundle size (depending on features imported)

Quick Start

  1. Install vue-query

    $ npm i @tanstack/vue-query
    

    or

    $ pnpm add @tanstack/vue-query
    

    or

    $ yarn add @tanstack/vue-query
    

    or

    $ bun add @tanstack/vue-query
    

    If you are using Vue 2.6, make sure to also setup @vue/composition-api

  2. Initialize Vue Query via VueQueryPlugin

    import { createApp } from 'vue'
    import { VueQueryPlugin } from '@tanstack/vue-query'
    
    import App from './App.vue'
    
    createApp(App).use(VueQueryPlugin).mount('#app')
    
  3. Use query

    import { defineComponent } from 'vue'
    import { useQuery } from '@tanstack/vue-query'
    
    export default defineComponent({
      name: 'MyComponent',
      setup() {
        const query = useQuery({ queryKey: ['todos'], queryFn: getTodos })
    
        return {
          query,
        }
      },
    })
    
  4. If you need to update options on your query dynamically, make sure to pass them as reactive variables

    const id = ref(1)
    const enabled = ref(false)
    
    const query = useQuery({
      queryKey: ['todos', id],
      queryFn: () => getTodos(id),
      enabled,
    })
    

Related Packages

@tanstack/vue-virtual

Headless UI for virtualizing scrollable elements in Vue

62,157,989 7,170
@tanstack/vue-table

Headless UI for building powerful tables & datagrids for Vue.

21,349,923 28,526
@tanstack/vue-query-devtools

Developer tools to interact with and visualize the TanStack/vue-query cache

3,832,492 50,490
@tanstack/vue-store

Framework agnostic type-safe store w/ reactive framework adapters

2,492,174 911
@tanstack/vue-form

Powerful, type-safe forms for Vue.

1,834,873 6,750

Version History

Version Released Vue License
5.105.0 ^2.6.0 || ^3.3.0 MIT
5.104.5 ^2.6.0 || ^3.3.0 MIT
5.104.4 ^2.6.0 || ^3.3.0 MIT
5.104.3 ^2.6.0 || ^3.3.0 MIT
5.104.2 ^2.6.0 || ^3.3.0 MIT
Pre-releases (85)
Version Released Vue License
5.0.0-rc.16 ^2.6.0 || ^3.3.0 MIT
5.0.0-rc.15 ^2.6.0 || ^3.3.0 MIT
5.0.0-rc.12 ^2.6.0 || ^3.3.0 MIT
5.0.0-rc.11 ^2.6.0 || ^3.3.0 MIT
5.0.0-rc.6 ^2.6.0 || ^3.3.0 MIT