research-tanstack-query

Explains TanStack Query patterns for data fetching and caching in Next.js.

1|Updated Sep 26, 2025
One-click install
npx skills add https://github.com/pascallammers/mylo-travel-concierge-v2 --skill research-tanstack-query
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: research-tanstack-query
Source: https://github.com/pascallammers/mylo-travel-concierge-v2/tree/main/.claude/skills/research-tanstack-query
Command: npx skills add https://github.com/pascallammers/mylo-travel-concierge-v2 --skill research-tanstack-query

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps developers understand and implement advanced data fetching, caching, and state management patterns using Tanstack Query (React Query) within a Next.js application.

Core Features & Use Cases

  • Pattern Research: Provides guidance on queries, mutations, optimistic updates, pagination, and infinite scrolling.
  • Integration Guidance: Explains how to integrate Tanstack Query with Next.js Server Components, Server Actions, and SSR.
  • Use Case: When building a complex dashboard with multiple data sources and interactive elements, this Skill can be used to research the most efficient Tanstack Query patterns for fetching, caching, and updating data across client and server components.

Quick Start

Research Tanstack Query patterns for integrating with Next.js Server Components.

Frequently Asked Questions about research-tanstack-query

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

FAQPage Schema
How do I integrate TanStack Query with Next.js Server Components and SSR?

TanStack Query integrates with Next.js Server Components and SSR by prefetching data on the server and hydrating queries on the client. This pattern ensures efficient client-side data fetching and caching without duplicating requests during initial page load.

What is the best way to handle optimistic updates and mutations in React Query?

Optimistic updates and mutations in React Query are handled by updating the query cache immediately before the server response arrives. This pattern allows interactive dashboards to reflect data changes instantly while automatically rolling back if the mutation fails.

How do I structure query keys for pagination and infinite scroll in TanStack Query?

Query keys for pagination and infinite scroll in TanStack Query are structured as arrays containing the query name and pagination parameters. This structure allows the cache to manage and fetch subsequent pages efficiently while maintaining distinct cache entries for each page subset.

Does TanStack Query work with Next.js Server Actions for data mutations?

TanStack Query works with Next.js Server Actions by triggering mutations through the useMutation hook. This combination allows developers to handle form submissions and data updates while leveraging TanStack Query's global error handling and loading state management.

Why do I need global error handling and loading state management in React Query?

Global error handling and loading state management in React Query are needed to centralize UI feedback for asynchronous operations. This pattern prevents repetitive error checking in individual components and ensures consistent loading indicators across complex applications with multiple data sources.