react-patterns
React Patterns
Source: React Documentation — Official React mental model
Philosophy: Generic principles, informed by anti-patterns we've seen in this codebase. Timeless rules, not line-number references.
The Golden Rule
Write idiomatic React. Respect the component lifecycle (mount → update → unmount), keep renders pure, and use hooks correctly (useEffect, useCallback, useRef, useMemo).
React will call your component multiple times, in any order, at any time. Code that works "by accident" will break unpredictably.
When to Use This Skill
- Writing or reviewing React components
- Fixing lint errors related to hooks or purity
- Deciding where to put logic (render vs effect vs handler)
Key Principles
More from saleor/storefront
saleor-paper-storefront
>
10ui-components
Create and style UI components with design tokens. Use when creating components, styling with Tailwind, deciding between Server/Client Components, or using shadcn/ui primitives.
4caching-strategy
Understand the caching architecture, Cache Components (PPR), and revalidation mechanisms. Use when debugging stale content, modifying caching behavior, or understanding data freshness guarantees.
4pdp
Product Detail Page architecture, image gallery/carousel, caching, and add-to-cart flow. Use when modifying PDP layout, debugging gallery swipe/thumbnails, understanding LCP optimization, fixing ErrorBoundary issues, or working with variant-specific images.
3filtering-system
Product list filtering and sorting architecture. Use when modifying filters, adding new filter types, working on category/collection pages, or understanding server-side vs client-side filtering.
3checkout-architecture
Reference for reusable checkout UI components. Use when working with SignInForm, AddressSelector, PaymentMethodSelector, or composing checkout step views.
3