React UI Patterns
Core Principles
- Never show stale UI - Loading spinners only when actually loading
- Always surface errors - Users must know when something fails
- Optimistic updates - Make the UI feel instant
- Progressive disclosure - Show content as it becomes available
- 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.
Loading State Decision Tree
Skeleton vs Spinner
Error Handling Patterns
The Error Handling Hierarchy
Always Show Errors
CRITICAL: Never swallow errors silently.
Error State Component Pattern
Button State Patterns
Button Loading State
Disable During Operations
CRITICAL: Always disable triggers during async operations.
Empty States
Empty State Requirements
Every list/collection MUST have an empty state:
Contextual Empty States
Form Submission Pattern
Anti-Patterns
Loading States
Error Handling
Button States
Checklist
Before completing any UI component:
UI States:
- Error state handled and shown to user
- Loading state shown only when no data exists
- Empty state provided for collections
- Buttons disabled during async operations
- Buttons show loading indicator when appropriate
Data & Mutations:
- Mutations have onError handler
- All user actions have feedback (toast/visual)
Integration with Other Skills
- graphql-schema: Use mutation patterns with proper error handling
- testing-patterns: Test all UI states (loading, error, empty, success)
- formik-patterns: Apply form submission patterns


