moai-ref-react-patterns

Featured

React/Next.js component design patterns, state management strategies, and project structure reference for frontend development. Agent-extending skill that amplifies frontend domain work (spawned via Agent(general-purpose) with frontend instructions) with production-grade React patterns. NOT for: backend API design, database modeling, DevOps, mobile apps.

Web & Frontend 1,120 stars 207 forks Updated today Apache-2.0

Install

View on GitHub

Quality Score: 99/100

Stars 20%
100
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# React Patterns Reference ## Target Spawn Frontend domain work spawned via `Agent(general-purpose)` with frontend instructions - Applies these patterns directly to component design and state management. ## Component Design Patterns ### 1. Compound Components Parent and child share implicit state via Context. Suited for: Tab, Accordion, Dropdown, Select Structure: `<Select>` + `<Select.Trigger>` + `<Select.Option>` ### 2. Custom Hooks (Extraction Pattern) Extract state logic into reusable hooks. Suited for: Form management, API calls, localStorage, debounce Naming: `use` prefix required - `useForm`, `useDebounce`, `useAuth` ### 3. Container/Presentational Separation Separate data logic (Container) from UI (Presentational). Suited for: Large apps, when testability is needed Container: Data fetch, state management, event handlers Presentational: Renders only from props, functionally pure ### 4. Headless Component Provides behavior/state without UI. Suited for: Design system-independent logic Examples: headless `useCombobox`, `useDialog`, `useTable` ## State Management Selection Guide | State Type | Tool | Rationale | |-----------|------|-----------| | UI Local | useState, useReducer | Component-internal | | Server State | React Query / TanStack Query | Caching, refetch, optimistic | | Global Client | Zustand | Concise, minimal boilerplate | | Complex Global | Zustand + Immer | Immutability convenience | | URL State | nuqs / useSearchParams | Filters, pagination | |...

Details

Author
modu-ai
Repository
modu-ai/moai-adk
Created
9 months ago
Last Updated
today
Language
Go
License
Apache-2.0

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category