
React Ui Patterns
A comprehensive guide to the loading, error, and empty states that make or break React UIs. The core insight is simple but constantly violated: only show loading spinners when you have no data, otherwise you get those annoying flashes on refetch. It walks through the full decision tree for each state, covers the error handling hierarchy from inline validation to full error screens, and hammers home the critical rule of always disabling buttons during async operations. The patterns are opinionated in a good way, with clear examples of what's wrong and what's right. If you've ever shipped a form that could be double-submitted or swallowed an error silently, this will fix your habits.
- skills.sh installs
- 529
- GitHub stars
- 33.2K
- last updated
- Aug 21, 2026
Install
$ npx -y skills add davila7/claude-code-templates --skill react-ui-patterns --agent claude-codeInstalls into .claude/skills of the current project.
Files
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.
// 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
Sponsors
Details
- Repository
- github.com/davila7/claude-code-templates
- Categories
- Frontend Development, Debugging
- First seen
- Jun 3, 2026
More from davila7/claude-code-templates
All 618- Marketing Demand Acquisition525
- Playwright Skill525
- Docx524
- Research Grants523
- Obsidian Markdown519
- Web Performance Optimization518
- Notion Knowledge Capture516
- Screenshot Feature Extractor514
- Skill Creation Guide514
- React Patterns503
- Executing Marketing Campaigns498
- React Dev498
- Knowledge Distillation497
- Rag Implementation497
- Coding Standards494
- Api Documentation Generator493
- Autonomous Agents492
- Backend Dev Guidelines492
- Database Schema Designer489
- Typescript Expert489
- Api Patterns486
- Skill Creator484
- Supabase Postgres Best Practices481
- File Organizer480