react-ui-patterns

Implements React UI patterns for loading states, error handling, and empty states.

1|Updated Jul 20, 2026
One-click install
npx skills add https://github.com/gonzoblasco/ai-developer-stack --skill react-ui-patterns-gonzoblasco
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: react-ui-patterns
Source: https://github.com/gonzoblasco/ai-developer-stack/tree/main/frontend-ui/react-ui-patterns
Command: npx skills add https://github.com/gonzoblasco/ai-developer-stack --skill react-ui-patterns-gonzoblasco

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? React applications often flash loading spinners over cached data, silently swallow errors, or leave users without feedback during async operations. This Skill provides concrete patterns and anti-patterns to handle loading, error, and empty states correctly in React components. ## Core Features & Use Cases - Loading State Rules: Apply the golden rule of showing loading indicators only when no data exists, with a decision tree and skeleton-vs-spinner guidance. - Error Handling Hierarchy: Implement a four-level error feedback strategy from inline field errors to full-screen error states, ensuring no error is silently swallowed. - Button and Form States: Disable buttons and show loading indicators during async operations to prevent duplicate submissions. - Use Case: When building a data-driven list page, use the provided pattern to render cached data during refetch, show a retry-enabled error component on failure, and display a contextual empty state when no items exist. ## Quick Start Ask the AI to review your React component's data fetching logic and apply the loading, error, and empty state patterns from this skill.

Frequently Asked Questions about react-ui-patterns

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

FAQPage Schema
How do I handle loading states in React without UI flashing?

Show a loading indicator only when there is no data to display: check `if (loading && !data)` before rendering a spinner. When refetching with cached data, keep rendering the existing data and optionally show a subtle refreshing indicator instead.

When should I use a skeleton vs a spinner in React?

Use skeletons when the content shape is known, such as list or card layouts and initial page loads. Use spinners for unknown content shapes, modal actions, button submissions, and inline operations.

How do I prevent duplicate form submissions in React?

Disable the submit button while the mutation is in flight by passing `disabled={isSubmitting}` and show progress with an `isLoading` prop. This blocks multiple clicks during async operations.

Why does my React error handling fail silently?

Errors fail silently when catch blocks or onError callbacks only log to the console without user feedback. Always surface errors through toast notifications, error banners, or error state components with a retry option.

Does React.memo always prevent re-renders?

React.memo only prevents re-renders when props are referentially equal. Functions passed to memoized children must be wrapped in useCallback, otherwise the function reference changes every render and memoization breaks.