tanstack-query

Manage React server-state with TanStack Query v5 data fetching and caching.

Updated Mar 30, 2026
One-click install
npx skills add https://github.com/Patkik/Multi-tenant-SaaS-Catering-V2 --skill tanstack-query-patkik
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tanstack-query
Source: https://github.com/Patkik/Multi-tenant-SaaS-Catering-V2/tree/main/.agents/skills/tanstack-query
Command: npx skills add https://github.com/Patkik/Multi-tenant-SaaS-Catering-V2 --skill tanstack-query-patkik

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) and assets (resource) components.

What problem does it solve?

TanStack Query v5 simplifies complex server-state management in React apps, consolidating data fetching, caching, and mutations under a cohesive API.

Core Features & Use Cases

  • Object-based hooks with consistent keys, cache invalidation after mutations, and support for SSR and DevTools.
  • Parallel and dependent queries, prefetching, suspense, and advanced mutation patterns like optimistic updates.
  • Easy migration from v4 to v5 with a clear pattern library and official guides.

Quick Start

Install TanStack Query v5 in a React project, configure a QueryClient with a provider, and enable DevTools to start managing server state and migrations.

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

To manage server state in React applications, you can use TanStack Query v5 to consolidate data fetching, caching, and mutations under a cohesive, object-based API. It simplifies complex server-state management across client components and SSR contexts.

How do I invalidate queries after mutations in React Query?

You invalidate queries after mutations in React Query by applying advanced mutation patterns, such as optimistic updates, to ensure the cache synchronizes with the server. This guarantees your UI reflects the latest server state accurately.

How do I migrate React Query from v4 to v5?

To migrate React Query from v4 to v5, you transition to object syntax usage, replace cacheTime with gcTime, and handle status flags like isPending. The v5 update provides a clear pattern library and official guides for seamless migration.

Does TanStack Query v5 support SSR and DevTools integration?

Yes, TanStack Query v5 supports SSR and DevTools integration. You configure a QueryClient with a provider and enable DevTools to start managing server state, allowing you to monitor caching and data fetching behavior effectively.

What is the best way to prefetch data and run parallel queries in React?

The best way to prefetch data and run parallel queries in React is using TanStack Query v5's object-based hooks. This approach allows you to configure dependent queries and suspense patterns for optimized server-state loading.