jpskill.com
🛠️ 開発・MCP コミュニティ 🔴 エンジニア向け 👤 エンジニア・AI開発者

🛠️ Reactパターン集

react-patterns

最新のReact開発において、効率的で再利用

⏱ ライブラリ調査+組込 半日 → 1時間

📺 まず動画で見る(YouTube)

▶ 【衝撃】最強のAIエージェント「Claude Code」の最新機能・使い方・プログラミングをAIで効率化する超実践術を解説! ↗

※ jpskill.com 編集部が参考用に選んだ動画です。動画の内容と Skill の挙動は厳密には一致しないことがあります。

📜 元の英語説明(参考)

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

🇯🇵 日本人クリエイター向け解説

一言でいうと

最新のReact開発において、効率的で再利用

※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-17
取得日時
2026-05-17
同梱ファイル
1

💬 こう話しかけるだけ — サンプルプロンプト

  • react-patterns を使って、最小構成のサンプルコードを示して
  • react-patterns の主な使い方と注意点を教えて
  • react-patterns を既存プロジェクトに組み込む方法を教えて

これをClaude Code に貼るだけで、このSkillが自動発動します。

📖 Claude が読む原文 SKILL.md(中身を展開)

この本文は AI(Claude)が読むための原文(英語または中国語)です。日本語訳は順次追加中。

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

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