Skip to main content

Installation

TanStack Query is available for all major JavaScript frameworks. Choose your framework below and install the corresponding package.

React

Install @tanstack/react-query for React 18 or 19 applications.
@tanstack/react-query requires React 18 or higher. The package provides hooks for managing async state and includes full TypeScript support.

React Devtools (Optional)

For development, install the React Query Devtools to visualize and debug your queries:

Vue

Install @tanstack/vue-query for Vue 2.6+, 2.7, or Vue 3 applications.
For Vue 2.6, you’ll also need to install @vue/composition-api as a peer dependency. Vue 2.7 and Vue 3 include the Composition API natively.

Vue Devtools (Optional)

Solid

Install @tanstack/solid-query for SolidJS 1.6+ applications.
@tanstack/solid-query provides reactive primitives that integrate seamlessly with Solid’s fine-grained reactivity system.

Solid Devtools (Optional)

Svelte

Install @tanstack/svelte-query for Svelte 5.25+ applications.
@tanstack/svelte-query is designed for Svelte 5 and leverages Svelte’s latest reactivity features.

Svelte Devtools (Optional)

Angular

Install @tanstack/angular-query-experimental for Angular 16+ applications.
The Angular package is currently experimental and uses Angular’s Signals API. It requires Angular 16 or higher.

Preact

Install @tanstack/preact-query for Preact 10+ applications.
@tanstack/preact-query provides the same hooks-based API as React Query, optimized for Preact.

Preact Devtools (Optional)

Additional Packages

TanStack Query offers additional packages for advanced use cases:

Persistence

Persist your query cache to localStorage, AsyncStorage, or custom storage:
  • React: @tanstack/react-query-persist-client
  • Vue: @tanstack/vue-query-persist-client
  • Solid: @tanstack/solid-query-persist-client
  • Svelte: @tanstack/svelte-query-persist-client
  • Angular: @tanstack/angular-query-persist-client
  • Preact: @tanstack/preact-query-persist-client

Storage Persisters

  • @tanstack/query-sync-storage-persister - For synchronous storage (localStorage, sessionStorage)
  • @tanstack/query-async-storage-persister - For asynchronous storage (IndexedDB, React Native AsyncStorage)

ESLint Plugin

Enforce best practices in your codebase:

Next Steps

Now that you’ve installed TanStack Query, you’re ready to start building:

Quick Start

Build your first query in minutes

Core Concepts

Learn the fundamental concepts