react-architecture

React Architecture & Patterns

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "react-architecture" with this command: npx skills add mileycy516-stack/skills/mileycy516-stack-skills-react-architecture

React Architecture & Patterns

Expert guidance on building scalable, maintainable, and performant React applications.

Use this skill when

  • Designing complex component hierarchies.

  • Refactoring "Prop Drilling" or massive components.

  • Implementation Compound Components.

  • Optimizing re-renders and state management.

  • Migrating to React Server Components (RSC).

  1. Composition Patterns

Compound Components

Encapsulate flexible parent-child relationships where they share implicit state.

// Usage <Select> <Select.Trigger /> <Select.List> <Select.Option value="1">Option 1</Select.Option> </Select.List> </Select>

// Implementation const SelectContext = createContext(); function Select({ children }) { ... } Select.Option = function Option({ value, children }) { ... }

Slots (Render Props)

Pass UI as data to avoid layout coupling.

function Layout({ header, content, footer }) { return ( <div className="grid"> <header>{header}</header> <main>{content}</main> <footer>{footer}</footer> </div> ) }

  1. State Management Rules
  • Local State (useState): UI interactions (isOpen, inputValue).

  • URL State: Search params, filters, pagination. (Use useSearchParams ).

  • Server State: API data (Use TanStack Query or SWR ).

  • Global State: Only for verified global needs (Theme, User Session). Use Zustand or Jotai . Do NOT use Redux unless legacy.

  1. Performance & Hooks
  • Memoization: Only use useMemo / useCallback for expensive calculations or referential stability in massive lists.

  • Custom Hooks: Extract logic (useWindowSize , useAuth ) to keep components view-focused.

  1. Next.js / Server Components
  • Fetch on Server: Make DB calls directly in async Server Components.

  • Client Islands: Push interactivity (useState ) down the tree to the leaves ('use client' ).

Resources

  • React Beta Docs

  • Patterns.dev

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

trading-psychology-coach

No summary provided by upstream source.

Repository SourceNeeds Review
General

planning

No summary provided by upstream source.

Repository SourceNeeds Review
General

vercel-react-best-practices

No summary provided by upstream source.

Repository SourceNeeds Review
General

debugging-strategies

No summary provided by upstream source.

Repository SourceNeeds Review