Skip to content

Opinionated React UI patterns for loading, error, empty, and async states, enforcing errors are always surfaced.

CCM score
70 of 100
skills.sh installs
529
GitHub stars
34.3K
last updated
Aug 21, 2026
View on GitHub

Own this skill? Claim it

What it does

  • Covers loading-state decisions, error hierarchy, empty states, button submission states, and form submission flow
  • Enforces showing a loading indicator only when no data exists, to avoid flashing spinners on refetch
  • Includes a decision tree plus skeleton-versus-spinner guidance, with ErrorState and EmptyState component patterns
  • Designed for React teams using GraphQL or Formik, and it cross-references testing-patterns for covering UI states

Install

$ npx -y skills add davila7/claude-code-templates --skill react-ui-patterns -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

React UI Patterns

Core Principles

  1. Never show stale UI - Loading spinners only when actually loading
  2. Always surface errors - Users must know when something fails
  3. Optimistic updates - Make the UI feel instant
  4. Progressive disclosure - Show content as it becomes available
  5. Graceful degradation - Partial data is better than no data

Loading State Patterns

The Golden Rule

Show loading indicator ONLY when there's no data to display.

// CORRECT - Only show loading when no data exists
const { data, loading, error } = useGetItemsQuery();

if (error) return <ErrorState error={error} onRetry={refetch} />;
if (loading && !data) return <LoadingState />;
if (!data?.items.length) return <EmptyState />;

return <ItemList items={data.items} />;
// WRONG - Shows spinner even when we have cached data
if (loading) return <LoadingState />; // Flashes on refetch!

Loading State Decision Tree

Is there an error?
  → Yes: Show error state with retry option
  → No: Continue

Is it loading AND we have no data?
  → Yes: Show loading indicator (spinner/skeleton)
  → No: Continue

Details

Repository
github.com/davila7/claude-code-templates
Categories
Frontend & UI Code, Testing & QA
First seen
Jun 3, 2026

More from davila7/claude-code-templates

All 398

Similar to React Ui Patterns

More Frontend & UI Code