tanstack-query

Manage server-state with caching, refetching, and mutations across TS/JS frameworks.

29|2|Updated Jan 25, 2026
One-click install
npx skills add https://github.com/tanstack-skills/tanstack-skills --skill tanstack-query-tanstack-skills
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tanstack-query
Source: https://github.com/tanstack-skills/tanstack-skills/tree/main/plugins/tanstack-query/skills/tanstack-query
Command: npx skills add https://github.com/tanstack-skills/tanstack-skills --skill tanstack-query-tanstack-skills

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

TanStack Query addresses the challenge of coordinating server-state across UI components, reducing stale data and boilerplate for fetching, caching, and syncing data.

Core Features & Use Cases

  • Efficient caching and background refetching with intelligent invalidation
  • Declarative data fetching and mutation APIs for React, Vue, Svelte, and more
  • Seamless support for SSR hydration and optimistic updates in complex UIs

Quick Start

Install TanStack Query in your project and begin wrapping data fetching with useQuery and mutations with useMutation.

Frequently Asked Questions about tanstack-query

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I manage server-state and cache fetched data in React?

You can cache fetched data and manage server-state in React using useQuery hooks. TanStack Query handles background refetching and intelligent invalidation to reduce boilerplate and prevent stale data across UI components.

What is server-state and how does it differ from regular client state?

Server-state is data fetched from a remote server that requires active synchronization to avoid becoming stale. TanStack Query manages server-state by handling caching, background refetching, and invalidation, reducing the boilerplate needed compared to storing remote data in standard client state.

Does TanStack Query support SSR hydration and data fetching in frameworks other than React?

Yes, TanStack Query supports SSR hydration and spans React, Vue, Solid, Svelte, and Angular. It provides declarative data fetching and mutation APIs to seamlessly handle server-state across these various frameworks.

How do I handle mutations and optimistic updates in TypeScript applications?

To handle mutations in TypeScript applications, use the useMutation API. TanStack Query enforces typed hooks for robust data flows and supports optimistic updates to immediately reflect changes in complex UIs before server confirmation.

What is the best way to invalidate cached queries and keep paginated data fresh?

The best way to keep paginated data fresh is through intelligent query invalidation. TanStack Query coordinates server-state by enforcing stable query keys, allowing you to precisely invalidate cached queries and trigger background refetching for updated data.