본문으로 건너뛰기
Skillpedia
웹사이트 및 UI (프런트엔드)48k · #5581

react-patterns

하는 일

이 가이드는 React 애플리케이션을 만들기 위한 현대적인 모범 사례와 패턴을 설명합니다. 코드를 체계적으로 구성하고, 데이터를 관리하고, 성능을 최적화하는 방법을 가르칩니다.

사용하는 경우

  • ✓새 React 프로젝트를 시작할 때.
  • ✓기존 React 코드를 리팩터링할 때.
  • ✓더 효율적인 React 코드 작성법을 배울 때.

스킬 링크

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/react-patterns/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/react-patterns/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“React의 컴포넌트 패턴에 대해 알려 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

AI는 React 패턴 가이드를 참고해 컴포넌트 유형, 설계 규칙, 훅 사용법, 상태 관리 같은 개념을 설명합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

React Patterns

Principles for building production-ready React applications.


1. Component Design Principles

Component Types

Type Use State
Server Data fetching, static None
Client Interactivity useState, effects
Presentational UI display Props only
Container Logic/state Heavy state

Design Rules

  • One responsibility per component
  • Props down, events up
  • Composition over inheritance
  • Prefer small, focused components

2. Hook Patterns

When to Extract Hooks

Pattern Extract When
useLocalStorage Same storage logic needed
useDebounce Multiple debounced values
useFetch Repeated fetch patterns
useForm Complex form state

Hook Rules

  • Hooks at top level only
  • Same order every render
  • Custom hooks start with "use"
  • Clean up effects on unmount

3. State Management Selection

Complexity Solution
Simple useState, useReducer
Shared local Context
Server state React Query, SWR
Complex global Zustand, Redux Toolkit

State Placement

Scope Where
Single component useState
Parent-child Lift state up
Subtree Context
App-wide Global store

4. React 19 Patterns

New Hooks

Hook Purpose
useActionState Form submission state
useOptimistic Optimistic UI updates
use Read resources in render

Compiler Benefits

  • Automatic memoization
  • Less manual useMemo/useCallback
  • Focus on pure components

5. Composition Patterns

Compound Components

  • Parent provides context
  • Children consume context
  • Flexible slot-based composition
  • Example: Tabs, Accordion, Dropdown

Render Props vs Hooks

Use Case Prefer
Reusable logic Custom hook
Render flexibility Render props
Cross-cutting Higher-order component

6. Performance Principles

When to Optimize

Signal Action
Slow renders Profile first
Large lists Virtualize
Expensive calc useMemo
Stable callbacks useCallback

Optimization Order

  1. Check if actually slow
  2. Profile with DevTools
  3. Identify bottleneck
  4. Apply targeted fix

7. Error Handling

Error Boundary Usage

Scope Placement
App-wide Root level
Feature Route/feature level
Component Around risky component

Error Recovery

  • Show fallback UI
  • Log error
  • Offer retry option
  • Preserve user data

8. TypeScript Patterns

Props Typing

Pattern Use
Interface Component props
Type Unions, complex
Generic Reusable components

Common Types

Need Type
Children ReactNode
Event handler MouseEventHandler
Ref RefObject<Element>

9. Testing Principles

Level Focus
Unit Pure functions, hooks
Integration Component behavior
E2E User flows

Test Priorities

  • User-visible behavior
  • Edge cases
  • Error states
  • Accessibility

10. Anti-Patterns

❌ Don't ✅ Do
Prop drilling deep Use context
Giant components Split smaller
useEffect for everything Server components
Premature optimization Profile first
Index as key Stable unique ID

11. File Structure

<img width="1150" height="1438" alt="image" src="https://github.com/user-attachments/assets/10369698-472c-4695-a494-2c0672103aa1" />

Use this image as a reference for a better file structure of the project


Remember: React is about composition. Build small, combine thoughtfully.

When to Use

This skill is applicable to execute the workflow or actions described in the overview.

Example

User request:

Use @react-patterns for this task: Modern React patterns and principles.

Limitations

  • Use this skill only when the task clearly matches the scope described above.
  • Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
  • Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.
자주 묻는 질문

React의 '훅'이란 무엇인가요?

함수형 컴포넌트에서 상태나 생명주기 같은 React 기능을 사용하게 해 주는 특별한 함수입니다.

'상속보다 컴포지션'은 무엇을 뜻하나요?

다른 컴포넌트를 상속하는 컴포넌트를 만들기보다, 작은 컴포넌트를 조합해 컴포넌트를 만드는 것이 더 좋다는 뜻입니다.

React 앱의 성능을 어떻게 높일 수 있나요?

가이드는 꼭 필요할 때만 최적화하고, 프로파일링 도구를 사용하며, 확인된 병목 지점에 맞는 해결책을 적용하라고 제안합니다.

상세 정보

작성자의 원본 설명

Modern React patterns and principles. Hooks, composition, performance, TypeScript best practices.

repo: sickn33/agentic-awesome-skills

인기도

GitHub 스타
48k
순위
#5581
라이선스
MIT
업데이트
2026. 10. 15.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬