react-data-fetching

Refactor React data fetching with TanStack Query caching and Suspense.

Updated Mar 12, 2026
One-click install
npx skills add https://github.com/Hallinna/interveiw-study-2026 --skill react-data-fetching-hallinna
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: react-data-fetching
Source: https://github.com/Hallinna/interveiw-study-2026/tree/main/.agents/skills/react-data-fetching
Command: npx skills add https://github.com/Hallinna/interveiw-study-2026 --skill react-data-fetching-hallinna

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It prevents slow and error-prone React data loading caused by request waterfalls, redundant fetches, and missing caching, retries, and consistent loading coordination.

Core Features & Use Cases

  • Parallel loading to eliminate waterfalls: Convert sequential dependent network calls into concurrent requests using patterns like Promise.all and dependency-aware promise orchestration.
  • Production-grade client data fetching: Replace useEffect + fetch state management with TanStack Query (and optionally SWR) for caching, deduplication, background revalidation, and structured error handling.
  • Declarative loading with Suspense: Use Suspense boundaries and suspense-capable hooks to coordinate UI loading states without spreading isLoading logic across the tree.
  • Performance upgrades for navigation and updates: Prefetch route data before navigation, implement optimistic updates for instant feedback, and deduplicate global event listeners and browser scroll/touch listeners.

Quick Start

Ask the AI to refactor your React component so that its server data fetching uses TanStack Query with an appropriate queryKey, parallelizes independent requests, and uses Suspense for clean loading boundaries.

Frequently Asked Questions about react-data-fetching

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

FAQPage Schema
How do I fix slow React data loading caused by request waterfalls?

To fix slow React data loading caused by request waterfalls, you must identify dependent versus independent network calls and parallelize independent requests using Promise.all or dependency-aware promise orchestration to eliminate sequential fetching.

What is the best way to replace useEffect for fetching data in React?

The best way to replace useEffect for fetching data in React is using TanStack Query or SWR for structured caching, request deduplication, background revalidation, and error handling that manual fetch state management lacks.

How does Suspense handle loading states for React data fetching?

Suspense handles loading states for React data fetching by using Suspense boundaries and suspense-capable hooks to declaratively coordinate UI loading states without spreading isLoading logic across your component tree.

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

To implement optimistic updates with TanStack Query in React, you apply mutations for instant UI feedback while enforcing structured optimistic update rollback behavior to revert the cache if the server request fails.

Can I prefetch route data before navigation in a Vite React application?

Yes, you can prefetch route data before navigation in a Vite React application by implementing prefetching and route loader patterns to fetch required server data ahead of route transitions for smoother performance.

When should I not use TanStack Query for React data fetching?

You should not use TanStack Query for React data fetching if your application relies solely on static client state without server data, as its structured caching, deduplication, and background revalidation mechanisms target dynamic server-data loading.