moai-ref-react-patterns

Provides React and Next.js component design patterns, state management guidance, and project structure reference.

2|Updated May 27, 2026
One-click install
npx skills add https://github.com/yekinya/moai-novel --skill moai-ref-react-patterns-yekinya
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: moai-ref-react-patterns
Source: https://github.com/yekinya/moai-novel/tree/main/moai-novel/.claude/skills/moai-ref-react-patterns
Command: npx skills add https://github.com/yekinya/moai-novel --skill moai-ref-react-patterns-yekinya

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Frontend developers often make inconsistent architectural decisions when designing React components, choosing state management tools, and structuring Next.js projects, leading to unmaintainable codebases and performance issues. ## Core Features & Use Cases - Component Design Patterns: Reference for compound components, custom hooks, container/presentational separation, and headless components with clear guidance on when to apply each. - State Management Selection Guide: Decision flow and comparison table covering useState, React Query, Zustand, nuqs, React Hook Form, and Context for different state types. - Quality Standards & Checklists: Concrete rules for component size, props limits, error boundaries, performance patterns, accessibility, and common anti-pattern red flags. - Use Case: When building a Next.js dashboard, consult this reference to decide between React Query and Zustand for server state, structure the app directory with route groups, and verify components against the accessibility checklist. ## Quick Start Ask the expert-frontend agent to review your React component architecture and recommend the appropriate state management approach for your Next.js project.

Frequently Asked Questions about moai-ref-react-patterns

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I choose between Zustand and React Query for state management?

Use React Query for server state that needs caching, refetching, and optimistic updates. Use Zustand for global client state shared across components, adding Immer when you need convenient immutable updates for complex state.

What component design pattern should I use in React?

Use compound components for Tabs, Accordions, and Selects sharing implicit state via Context. Extract reusable logic into custom hooks, separate data logic from UI with container/presentational split, and use headless components for design-system-independent behavior.

Is useEffect still acceptable for data fetching in React 19?

No, useEffect for data fetching is a legacy pattern that causes request waterfalls. React 19 provides the use() hook and server components for data fetching, or use React Query for client-side server state.

How should I structure a Next.js App Router project?

Organize routes with route groups like (auth) and (main) under src/app, place base UI in components/ui and feature components in components/features, and keep custom hooks, Zustand stores, types, and utilities in dedicated directories.

When should I use memoization in React components?

Apply useMemo and React.memo only for expensive computations or components rendering large lists, and profile before assuming slowness. Use React.lazy or next/dynamic for bundle size, and @tanstack/react-virtual for lists over 1000 items.