react-data-fetching

Parallelize React data fetching with caching and Suspense.

1|Updated Jul 12, 2025
One-click install
npx skills add https://github.com/ubay1/next15-starter --skill react-data-fetching-ubay1
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: react-data-fetching
Source: https://github.com/ubay1/next15-starter/tree/main/.agents/skills/react-data-fetching
Command: npx skills add https://github.com/ubay1/next15-starter --skill react-data-fetching-ubay1

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It eliminates slow React data-loading experiences caused by request waterfalls, redundant network calls, and inconsistent loading/error handling.

Core Features & Use Cases

  • Parallelize Independent Fetches: Replace sequential requests with concurrent loading to reduce total latency in complex pages.
  • Use a Dedicated Data Layer (TanStack Query/SWR): Enable caching, deduplication, retries, background revalidation, and standardized error/loading states across the app.
  • Coordinate Loading with Suspense and Prefetching: Use Suspense boundaries and prefetch data on navigation intent to remove UI jank during route changes.
  • Enhance Mutations with Optimistic Updates: Make mutations feel instant while still reconciling with server truth.
  • Avoid Server/Component-Level Waterfalls: Restructure component trees so child data fetching does not wait on parent results unnecessarily.

Quick Start

Apply the recommended patterns to your React components by identifying fetch-in-effect and sequential requests, then refactor the flow to use caching via TanStack Query (or SWR), Suspense boundaries, and parallel query execution.

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 React request waterfalls and slow component rendering?

To fix React request waterfalls, you parallelize independent fetches using Promise.all and restructure component trees so child requests do not wait on parent results unnecessarily. This reduces total page latency by eliminating sequential data loading.

How do I set up TanStack Query caching and Suspense for data fetching in React?

Set up TanStack Query caching by replacing fetch-in-effect patterns with deduplicated cached queries, then wrap component trees in Suspense boundaries for declarative loading. This standardizes error and loading states while removing UI jank during navigation.

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

The best way to handle optimistic updates is to apply mutation patterns that instantly update the UI while reconciling with server truth using query invalidation. This makes mutations feel instant without losing data consistency.

Does this data fetching approach work with existing React components that use sequential requests?

Yes, it works by refactoring existing component trees that load server data. You identify sequential requests and fetch-in-effect patterns, then replace them with parallel query execution and caching to remove redundant client fetching.

Why are my React components making redundant network calls and how do I stop it?

Redundant network calls happen when components fetch the same data independently without a dedicated data layer. You stop it by enabling deduplicated cached queries with background revalidation, ensuring requests are shared and reused across the app.

When should I prefetch data around navigation in a React application?

You should prefetch data on navigation intent to remove UI jank during route changes. By coordinating loading with Suspense boundaries and prefetching, you ensure data is ready before the component renders, preventing loading flashes.