Skip to main content

Installation

Install TanStack Query using your preferred package manager. The library is available for multiple frameworks.

React Query

For React applications, install @tanstack/react-query:
TanStack React Query requires React 18 or 19 as a peer dependency.

DevTools (Optional)

The DevTools package helps you visualize and debug your queries during development:
DevTools are included in the main package bundle but tree-shake away in production builds automatically.

Other Frameworks

Vue Query

For Vue 3 applications:

Svelte Query

For Svelte applications:

Solid Query

For SolidJS applications:

Angular Query (Experimental)

For Angular applications:
Angular Query is currently experimental. The API may change in future releases.

Optional Packages

Persist Client

Persist and sync your query cache to localStorage, sessionStorage, or AsyncStorage:
For React Native or async storage:

ESLint Plugin

Enforce best practices and catch common mistakes:

CDN Usage

For quick prototyping or simple projects, you can use TanStack Query via CDN:
CDN usage is not recommended for production applications. Use a package manager for better performance and reliability.

Requirements

  • React Query: React 18+
  • Vue Query: Vue 3+
  • Svelte Query: Svelte 4+
  • Solid Query: SolidJS 1.6+
  • Node.js: 16+ (for development)

TypeScript

TanStack Query is written in TypeScript and includes type definitions out of the box. No additional @types packages are needed.
For the best TypeScript experience, use TypeScript 5.0 or later.

Next Steps

Now that you’ve installed TanStack Query, check out the Quick Start guide to build your first query.