tanstack-query

Manage asynchronous server state in React with TanStack Query hooks.

68|19|Updated Nov 21, 2025
One-click install
npx skills add https://github.com/bobmatnyc/claude-mpm-skills --skill tanstack-query-bobmatnyc
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tanstack-query
Source: https://github.com/bobmatnyc/claude-mpm-skills/tree/main/toolchains/typescript/state/tanstack-query
Command: npx skills add https://github.com/bobmatnyc/claude-mpm-skills --skill tanstack-query-bobmatnyc

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill simplifies complex asynchronous server-state management in React applications, eliminating boilerplate for data fetching, caching, and synchronization.

Core Features & Use Cases

  • Declarative Data Fetching: Manage server state with hooks like useQuery and useMutation.
  • Automatic Caching & Background Updates: Ensures data is fresh and UI is responsive with features like stale-while-revalidate.
  • Optimistic Updates & Pagination: Provides smooth user experiences for mutations and infinite scrolling.
  • Use Case: Integrate TanStack Query into your React app to fetch user data, manage user creation/updates with optimistic UI, and implement infinite scrolling for a list of posts, all while ensuring data consistency and performance.

Quick Start

Install TanStack Query and its devtools by running npm install @tanstack/react-query @tanstack/react-query-devtools.

Frequently Asked Questions about tanstack-query

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

FAQPage Schema
How do I manage asynchronous server state in React without writing boilerplate data fetching logic?

TanStack Query manages asynchronous server state in React declaratively using useQuery and useMutation hooks, handling data fetching, caching, and background synchronization automatically to eliminate manual boilerplate.

How do I implement optimistic updates and infinite scrolling for React data fetching?

Implement optimistic updates and infinite scrolling in React data fetching by leveraging TanStack Query's built-in mutation and pagination features, ensuring smooth UI transitions and efficient data consistency during server synchronization.

Does TanStack Query work with GraphQL and tRPC APIs for React state management?

Yes, TanStack Query works with REST, GraphQL, and tRPC APIs for React state management, providing a unified approach to server-state synchronization, background refetching, and caching across different API protocols.

What is the best way to cache and synchronize server data in a React application?

The best way to cache and synchronize server data in React is using a stale-while-revalidate strategy, which TanStack Query provides natively to ensure your UI remains responsive while automatically refetching outdated data in the background.

How do I set up TanStack Query in my React project?

To set up TanStack Query in a React project, install the core package and devtools via npm install @tanstack/react-query @tanstack/react-query-devtools, then integrate the hooks into your components for declarative data management.