tanstack-query-v5

Reference TanStack Query v5 hooks for React server state management.

7|4|Updated Mar 2, 2026
One-click install
npx skills add https://github.com/nklisch/skills --skill tanstack-query-v5-nklisch
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tanstack-query-v5
Source: https://github.com/nklisch/skills/tree/main/.agents/skills/tanstack-query-v5
Command: npx skills add https://github.com/nklisch/skills --skill tanstack-query-v5-nklisch

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Developers often struggle with recalling exact syntax, options, and best practices for TanStack Query hooks during React app development, leading to errors and slower coding.

Core Features & Use Cases

  • API Quick Reference: Covers core hooks like useQuery, useMutation, useInfiniteQuery, and QueryClient methods with examples and key options.
  • Gotchas & Patterns: Highlights common pitfalls, version-specific caveats, and patterns like optimistic updates and query key organization.
  • Use Case: When building a todo app, use this reference to implement caching with useQuery for fetching lists and useMutation for updates, ensuring efficient state management without redundant API calls.

Quick Start

Load the tanstack-query-v5 skill to get a quick reference on implementing useQuery for fetching user data in my React component.

Frequently Asked Questions about tanstack-query-v5

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

FAQPage Schema
How do I use TanStack Query v5 for data fetching in React?

TanStack Query v5 data fetching uses the useQuery hook to manage server state, automatically caching responses and refetching data in the background to keep your UI synchronized without redundant API calls.

How do I implement optimistic updates with useMutation in React Query?

Optimistic updates with useMutation in React Query allow you to immediately update the UI before the server response arrives, leveraging QueryClient methods to rollback changes if the mutation fails.

What changed in the useQuery API for TanStack Query v5?

TanStack Query v5 changed the useQuery API by removing the object signature for direct arguments, requiring queryKey and queryFn as top-level parameters alongside updated hook configurations for server state management.

What is the best way to organize query keys for React Query caching?

Organizing query keys for React Query caching involves using consistent array structures for query key serialization, enabling precise cache invalidation and background refetching when underlying data mutations occur.

Does TanStack Query v5 work without external dependencies?

TanStack Query v5 works as a standalone reference for React applications, providing implementation patterns for data fetching, caching, and mutations without requiring external runtime execution dependencies.

How do I fetch paginated data with useInfiniteQuery in React Query?

Fetching paginated data with useInfiniteQuery in React Query involves configuring hook options to load sequential pages on demand, efficiently managing server state and caching for infinite scrolling interfaces.