スキル一覧に戻る
eyadsibai

react

by eyadsibai

0🍴 0📅 2026年1月15日
GitHubで見るManusで実行

SKILL.md


name: React description: This skill should be used when the user asks about "React", "React components", "React hooks", "useState", "useEffect", "JSX", "React patterns", "React best practices", or mentions React development. version: 1.0.0

React Development

Guidance for building React applications with modern patterns.


Hooks Reference

Built-in Hooks

HookPurposeWhen to Use
useStateLocal stateSimple values, toggles, form inputs
useReducerComplex stateMultiple sub-values, state machines
useEffectSide effectsData fetching, subscriptions, DOM manipulation
useContextConsume contextTheme, auth, global state
useRefMutable referenceDOM access, persist values across renders
useMemoMemoize valueExpensive calculations
useCallbackMemoize functionStable callbacks for child components
useLayoutEffectSync DOM effectsMeasure DOM before paint
useIdUnique IDsAccessibility, form labels

Hook Rules

RuleWhy
Only call at top levelHooks rely on call order
Only call from React functionsComponents or custom hooks
Name custom hooks with "use"Convention for linting

Component Patterns

PatternUse CaseKey Concept
PresentationalPure UI, no logicProps in, JSX out
ContainerData fetching, stateWraps presentational
Compound ComponentsRelated components sharing stateParent provides context
Render PropsShare behaviorFunction as child
Custom HooksReusable stateful logicExtract from components
HOCLegacy patternPrefer hooks instead

State Management Decision

SolutionBest ForTrade-offs
useStateComponent-localSimplest, prop drilling for sharing
useReducerComplex local stateMore boilerplate, predictable
ContextTheme, auth, i18nRe-renders all consumers
ZustandSimple globalMinimal API, good devtools
Redux ToolkitComplex globalPowerful, more boilerplate
React Query/TanStackServer stateCaching, background refresh
Jotai/RecoilAtomic stateFine-grained updates

Key concept: Server state (API data) and client state (UI state) should be managed differently. Use React Query for server state.


useEffect Patterns

PatternDependency ArrayPurpose
Run once[]Initial fetch, setup
Run on change[dep1, dep2]React to specific changes
Run every render(omit)Rarely needed
CleanupReturn functionSubscriptions, timers

Common Pitfalls

PitfallSolution
Infinite loopsInclude all dependencies, use useCallback
Stale closuresUse refs or functional updates
Race conditionsCleanup flag or AbortController
Missing depsTrust the linter, refactor if needed

Performance Optimization

TechniqueWhen to UseCost
React.memoExpensive child, frequent parent rendersShallow comparison
useMemoExpensive calculationMemory for cached value
useCallbackCallback passed to memoized childMemory for function
Lazy loadingLarge components, routesInitial load vs waterfall
VirtualizationLong lists (100+ items)Complexity

Key concept: Don't optimize prematurely. Measure first with React DevTools Profiler.


Conditional Rendering

PatternUse Case
&&Show/hide single element
TernaryTwo alternatives
Early returnMultiple conditions, cleaner
Switch/object mapMany alternatives

Form Handling

ApproachUse Case
ControlledNeed validation, formatting
Uncontrolled (refs)Simple forms, performance
React Hook FormComplex forms, validation
FormikLegacy, full-featured

Key concept: Controlled components store value in React state. Uncontrolled use DOM as source of truth.


Project Structure

DirectoryPurpose
components/ui/Generic, reusable (Button, Card)
components/features/Feature-specific compositions
hooks/Custom hooks
contexts/React contexts + providers
pages/ or routes/Route components
services/ or api/API calls, data fetching
types/TypeScript types
utils/Pure helper functions

Best Practices

PracticeWhy
Keep components small (<100 lines)Readable, testable
Colocate related codeEasier to maintain
Lift state only when neededAvoid unnecessary complexity
Use TypeScript for propsCatch errors, better DX
Prefer composition over inheritanceReact's design philosophy
Extract custom hooksReusable logic, testable

Resources

スコア

総合スコア

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

レビュー

💬

レビュー機能は近日公開予定です