tanstack-query

Migrate TanStack Query v4 to v5 in React applications.

961|99|Updated Oct 20, 2025
One-click install
npx skills add https://github.com/jezweb/claude-skills --skill tanstack-query-jezweb
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tanstack-query
Source: https://github.com/jezweb/claude-skills/tree/main/skills/tanstack-query
Command: npx skills add https://github.com/jezweb/claude-skills --skill tanstack-query-jezweb

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @tanstack/react-query, @tanstack/react-query-devtools, and includes templates (resource) and references (resource) and rules (resource) components.

What problem does it solve?

This Skill eliminates the complexity of managing server state in React applications, preventing common v5 migration errors and saving hours of debugging time.

Core Features & Use Cases

  • v5 Migration: Automatically fixes 8 documented breaking changes from React Query v4 to TanStack Query v5.
  • Automated Caching: Configure intelligent caching strategies that prevent unnecessary network requests.
  • Use Case: When migrating a large React application from v4 to v5, use this Skill to automatically convert all queries to object syntax, replace cacheTime with gcTime, and handle query callback removals automatically.

Quick Start

Set up TanStack Query v5 in my React app with optimized caching and error handling.

Frequently Asked Questions about tanstack-query

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

FAQPage Schema
How do I migrate React Query from v4 to v5?

Migrate React Query v4 to v5 by converting queries to object syntax, replacing cacheTime with gcTime, updating isPending semantics, adding initialPageParam for infinite queries, and adjusting TypeScript types. This Skill automates these eight breaking changes to save migration time.

What's the best way to set up data fetching with useQuery in React?

Set up useQuery with TanStack Query v5 by configuring object-syntax queries, defining cache strategies, and handling errors. The Skill provides templates and migration patterns for optimized server state management.

How does caching work in TanStack Query v5?

TanStack Query v5 caches server state automatically using gcTime (formerly cacheTime) to prevent unnecessary network requests. Configure cache duration and stale-time thresholds to balance freshness and performance.

Can I use useInfiniteQuery with TanStack Query v5?

Yes. useInfiniteQuery works with TanStack Query v5 when you add initialPageParam to specify the starting page and follow object-syntax patterns. This Skill covers the v5-specific setup required.

What are the main breaking changes from React Query v4 to TanStack Query v5?

Key breaking changes include object-syntax requirement, cacheTime renamed to gcTime, isPending replacing isLoading, initialPageParam for infinite queries, and removed query callbacks. This Skill documents and automates all eight changes.