← All libraries

TanStack Query

JavaScript
↗ Official site

App memory & data sync

The smartest way to fetch and cache server data in React.

What it does

TanStack Query (formerly React Query) manages all the complexity of fetching data from an API — loading states, caching, background refetching, error handling — automatically. It makes your app feel much faster.

When to use it

Use this when your app fetches data from an API and you want smart caching and loading states.

Real example

You want to show a user feed that refreshes automatically in the background without a manual reload. Prompt: 'Use TanStack Query to fetch /api/feed with useQuery. Set staleTime to 30000 and refetchInterval to 60000. Show a loading skeleton on first load and silently update in the background after.'

Good to know

Works with React, Vue, Solid, and more. One of the most widely used libraries in modern React development.

Alternatives

SWR RTK Query

Install

$ npm install @tanstack/react-query

Use cases

data fetchingcachingAPIReact

Language

JavaScript

Category

App memory & data sync

More in App memory & data sync

Other tools in the same category