tanstack-query

Manage React server state with TanStack Query caching and background updates.

1|Updated Jan 22, 2026
One-click install
npx skills add https://github.com/oakoss/open-saas-kit --skill tanstack-query-oakoss
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tanstack-query
Source: https://github.com/oakoss/open-saas-kit/tree/main/.claude/skills/tanstack-query
Command: npx skills add https://github.com/oakoss/open-saas-kit --skill tanstack-query-oakoss

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Manage server state in React apps with caching and automatic background updates.

Core Features & Use Cases

  • Caching and background updates: automatic caching, stale data handling, and background refetching for responsive UIs.
  • Query and mutation patterns: support useQuery, useMutation, and useInfiniteQuery with robust cache invalidation patterns.
  • Use Case: build data-driven dashboards where multiple components read shared data and rely on synchronized state.

Quick Start

Install TanStack Query, create a QueryClient, wrap your app with QueryClientProvider, and start using useQuery, useMutation, and useInfiniteQuery for data fetching and state management.

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 data caching in React applications?

You can manage server state in React by using TanStack Query to handle data fetching, caching, and automatic background updates. Setting up a QueryClient and using hooks like useQuery ensures your UI stays synchronized with server data.

How do I fetch paginated data with infinite queries in React?

Fetch paginated data in React using the useInfiniteQuery hook from TanStack Query. This hook manages infinite scrolling patterns by automatically caching loaded pages and handling subsequent data fetching requests as users scroll.

What is the best way to handle data mutations and cache invalidation in React?

Handle data mutations and cache invalidation in React using the useMutation hook alongside TanStack Query. This pattern automatically invalidates affected queries, ensuring your cached server state updates correctly after successful data modifications.

Do I need to install external libraries to use TanStack Query for server state management?

Yes, you must install the @tanstack/react-query library to manage server state. You then create a QueryClient instance, wrap your application with the QueryClientProvider, and use hooks like useQuery to fetch and cache data.

Why do I need TanStack Query instead of standard React state for data fetching?

You need TanStack Query because standard React state lacks built-in caching, background refetching, and stale data management. TanStack Query handles server state complexities, ensuring multiple components can read shared data while maintaining synchronized state.

How do I set up TanStack Query for data fetching in a React dashboard?

Set up TanStack Query in a React dashboard by installing the library, creating a QueryClient, and wrapping your app with QueryClientProvider. You then use hooks like useQuery and useMutation to fetch data and keep UI state synchronized across components.