tanstack-query

Manage server-state data with caching, background updates, and optimistic mutations.

1|Updated Apr 24, 2026
One-click install
npx skills add https://github.com/Shreehari-Acharya/Bannin --skill tanstack-query-shreehari-acharya
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tanstack-query
Source: https://github.com/Shreehari-Acharya/Bannin/tree/main/client/.agents/skills/tanstack-query
Command: npx skills add https://github.com/Shreehari-Acharya/Bannin --skill tanstack-query-shreehari-acharya

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Efficiently manage server-state in modern TS/JS apps by providing reliable data fetching, caching, and synchronization across client and server boundaries.

Core Features & Use Cases

  • Automatic caching with background refetching and stale-while-revalidate patterns for data freshness.
  • Declarative data fetching and mutation workflows with optimistic updates, query invalidation, and prefetching.
  • SSR hydration and suspense-compatible data fetching for seamless server-side rendering and streaming.

Quick Start

Install the library, wrap your app with a QueryClientProvider, and start using useQuery and useMutation in components.

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 data fetching and caching in TS/JS applications?

Server-state data fetching and caching in TS/JS is managed by leveraging automatic caching, background refetching, and stale-while-revalidate patterns. This approach ensures data freshness while handling query invalidation and synchronization across client and server boundaries.

Can I use optimistic updates and mutations for data synchronization in React, Vue, or Svelte?

Optimistic updates and mutations for data synchronization are fully supported in React, Vue, and Svelte. Declarative mutation workflows handle query invalidation and prefetching, allowing seamless UI updates before server responses confirm the changes.

How does SSR hydration work with suspense-compatible data fetching for server-side rendering?

SSR hydration with suspense-compatible data fetching works by seamlessly bridging client and server boundaries during server-side rendering. It suspends component rendering until data is ready, then hydrates the client to ensure reliable streaming and state synchronization.

What is the best way to structure query keys for cache invalidation in TS/JS?

The best way to structure query keys for cache invalidation in TS/JS is through type-safe query key management. This allows precise targeting of cached data for invalidation, ensuring background refetching and stale-while-revalidate patterns update only the necessary queries.

Do I need to wrap my app with a provider to handle background updates and caching strategies?

You need to wrap your app with a QueryClientProvider to handle background updates and caching strategies. This setup initializes the client managing server-state, enabling useQuery and useMutation hooks for automatic refetching and reliable data synchronization.