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:
npm 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:
npm install @tanstack/react-query-devtools
DevTools are included in the main package bundle but tree-shake away in production builds automatically.

Other Frameworks

Vue Query

For Vue 3 applications:
npm install @tanstack/vue-query

Svelte Query

For Svelte applications:
npm install @tanstack/svelte-query

Solid Query

For SolidJS applications:
npm install @tanstack/solid-query

Angular Query (Experimental)

For Angular applications:
npm install @tanstack/angular-query-experimental
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:
npm install @tanstack/react-query-persist-client @tanstack/query-sync-storage-persister
For React Native or async storage:
npm install @tanstack/react-query-persist-client @tanstack/query-async-storage-persister

ESLint Plugin

Enforce best practices and catch common mistakes:
npm install -D @tanstack/eslint-plugin-query

CDN Usage

For quick prototyping or simple projects, you can use TanStack Query via CDN:
<script type="module">
  import { QueryClient, QueryClientProvider, useQuery } from 'https://esm.sh/@tanstack/react-query'
</script>
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.

Build docs developers (and LLMs) love