← スキル一覧に戻る

implementing-react-patterns
by BenWork17
⭐ 0🍴 0📅 2026年1月21日
SKILL.md
name: implementing-react-patterns description: Provides guidance on React design patterns like Composition, Render Props, and Custom Hooks. Use when architecting complex UI components.
Implementing React Patterns
Advanced patterns and best practices for building scalable React 18+ applications.
Core Patterns
1. Component Composition
Avoid prop drilling by passing components as props or using children.
function Parent({ children }) {
return <div className="p-4 border">{children}</div>;
}
2. Custom Hooks
Extract reusable logic into standalone hooks.
function useFetch<T>(url: string) {
const [data, setData] = useState<T | null>(null);
// ... fetching logic
return { data };
}
3. Compound Components
Manage shared state among a set of related components.
<Select>
<Select.Option value="1">Option 1</Select.Option>
<Select.Option value="2">Option 2</Select.Option>
</Select>
State Management
- Local State: Use
useStatefor simple, component-specific state. - Complex State: Use
useReducerfor state with multiple transitions. - Global State: Use Context API or libraries like Zustand/Redux for app-wide state.
Performance Optimization
useMemo: Memoize expensive calculations.useCallback: Memoize function references passed to child components.React.memo: Prevent unnecessary re-renders of functional components.
Best Practices
- Keep Components Small: One component should do one thing.
- Typescript: Always define interfaces for Props and State.
- Error Boundaries: Wrap critical UI sections to catch runtime errors.
- Hooks Rules: Only call hooks at the top level and within React functions.
スコア
総合スコア
50/100
リポジトリの品質指標に基づく評価
✓SKILL.md
SKILL.mdファイルが含まれている
+20
○LICENSE
ライセンスが設定されている
0/10
○説明文
100文字以上の説明がある
0/10
○人気
GitHub Stars 100以上
0/15
○最近の活動
3ヶ月以内に更新がある
0/10
○フォーク
10回以上フォークされている
0/5
✓Issue管理
オープンIssueが50未満
+5
✓言語
プログラミング言語が設定されている
+5
○タグ
1つ以上のタグが設定されている
0/5
レビュー
💬
レビュー機能は近日公開予定です