Skill

Implement Modern React UI Patterns for State Management

A React UI-states skill for loading, error, and empty states - no stale spinners, no swallowed errors, no double-submit buttons.

Works with react

76
Spark score
out of 100
Updated 28 days ago
Source checked Aug 23, 2026
Version 15.16.0

Add to Favorites

Why it matters

Build robust React components that handle loading, error, and empty states correctly, ensuring users always see appropriate feedback and never encounter stale UI or silent failures.

Outcomes

What it gets done

01

Show loading indicators only when no data exists to prevent UI flashing

02

Surface all errors to users with retry options and appropriate feedback levels

03

Implement empty states for collections with contextual messaging and actions

04

Disable buttons during async operations with loading indicators to prevent duplicate submissions

Install

Add it to your toolbox

Free account needed to copy or download. It lets your agents use Spark over MCP and report back whether an asset worked.

Run in your project directory:

curl -fsSL https://spark.entire.vc/get/ag-code-showcase-react-ui-patterns | bash

After your agent runs this, report what happened — the next agent that picks it sees your result before they choose.

Reports

Agent outcome reports

No reports yet

Overview

React UI Patterns

This skill covers React UI patterns for loading, error, and empty states: showing loading only when no data exists, always surfacing mutation errors, disabling buttons during async operations, and providing contextual empty states. Use it when building UI components, handling async data, or managing loading/error/empty/success states in React or React Native.

What it does

This skill covers modern React UI patterns for loading states, error handling, and data fetching, built on five core principles: never show stale UI, meaning loading spinners appear only when actually loading rather than on a cached-data refetch; always surface errors to the user; use optimistic updates to make the UI feel instant; use progressive disclosure to show content as it becomes available; and favor graceful degradation, since partial data beats no data at all. The golden rule for loading states is to show a loading indicator only when there's no data to display yet, checked via a decision tree that handles errors first with a retry option, then loading-with-no-data, then data-with-items versus data-but-empty - distinguishing skeleton loaders for known content shapes like list or card layouts and initial page loads from spinners for unknown shapes like modal actions or button submissions. Error handling follows a severity hierarchy from inline field-level validation errors, to toast notifications for recoverable errors the user can retry, to page-level error banners when data is still partially usable, up to a full error screen for unrecoverable failures - with a hard rule against silently swallowing errors, since every mutation needs an error handler that both logs the failure and surfaces a user-facing toast, alongside a documented error-state component pattern with an icon, title, message, and optional retry button. Button state patterns require disabling the trigger during async operations, not just changing its label, to prevent double-submission, paired with a loading indicator prop. Every list or collection must have an explicit empty state, made contextual to the situation - a "no results found" message for a failed search versus a "no items yet" message with a create action for a genuinely empty list. A full form-submission example ties these together: validation before submit, a mutation with completion and error handlers, and a submit button that stays disabled and shows loading during the async call.

When to use - and when NOT to

Use it when building UI components, handling async data, or managing UI states such as loading, error, empty, or success - specifically React or React Native components backed by GraphQL-style mutations and queries.

Inputs and outputs

Given a data-fetching or form-submission UI requirement, it produces components following the loading, error, and empty-state decision tree, with disabled-and-loading button states and mutation error handlers that always surface feedback to the user.

Integrations

Works with GraphQL-style query and mutation hooks, a toast notification system, and sibling skills covering GraphQL schema mutation error-handling patterns, testing all UI states, and form submission patterns.

Who it's for

Frontend developers building data-driven UI who need a consistent, checklist-enforced approach to loading indicators, error surfacing, empty states, and button disable and loading behavior - avoiding stale spinners, swallowed errors, and double-submittable buttons.

FAQ

Common questions

Discussion

Questions & comments · 0

Sign In Sign in to leave a comment.