react-patterns
Use when discussing React component design, hooks, state management, or rendering patterns.
Skill by UgochukwuChidera
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/ugochukwuchidera-react-patterns
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: design, frontend
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/react-patterns
What's inside
- Skill name
react-patterns- Description
- Use when discussing React component design, hooks, state management, or rendering patterns. Covers hooks patterns, component composition, performance optimization (useMemo/useCallback), Context vs Redux vs Zustand, custom hooks, render props, compound components, and error boundaries.
- License
- GPL-3.0
- Instructions
- 139 lines in SKILL.md · view on GitHub
Files (1)
- SKILL.md
SKILL.md (first lines)
## Git Delegation Rule
**HARD RULE**: NEVER run git commands. Delegate ALL git operations to `git-wrangler`.
# React Patterns
## Component Composition
### Compound Components
```tsx
// Parent manages shared state implicitly via React.Children
<Select>
<Select.Option value="a">Option A</Select.Option>
<Select.Option value="b">Option B</Select.Option>
</Select>
```
Use `React.Children.map` + `cloneElement` or Context to pass shared state.
### Render Props
```tsx
<MouseTracker render={(pos) => <Dot x={pos.x} y={pos.y} />} />
```
### Controlled vs Uncontrolled
- **Uncontrolled**: DOM manages its own state, use `ref` to read values.
- **Controlled**: React state is the single source of truth. Prefer this for form validation or conditional UI.
- **Mixed**: Pass `value` + `onChange` but allow internal default state — use `useControlledState` pattern.
## Hooks Patterns
### Custom Hook Naming
- `use` prefix, PascalCase after (e.g., `useLocalStorage`, `useDebounce`).
- Return a tuple for 2 values (`[value, setter]`), an object for 3+.
### Custom Hook Structure
```tsx
function useDebounce<T>(value: T, delay: number): T {
const [debounced, setDebounced] = useState(value);
useEffect(() => {
const id = setTimeout(() => setDebounced(value), delay);
return () => clearTimeout(id);
}, [value, delay]);
return debounced;
}
```
### Effect Cleanup
Every `useEffect` that subscribes, polls, or sets intervals **must** return a cleanup function. Missing cleanup is the #1 React memory leak.
## State Management Decision Tree
```
Simple useState → enough for 90% of cases
Prop drilling pain → lift state or compose children
Sibling/remote shared state → Context (for low-frequency updates)
Frequent updates (auth, theme) → Context is fine
Complex global state → Zustand or Jotai (NOT Redux by default)
Heavy server state → TanStack Query (React Query)
Form state → React Hook Form or Formik
```
### Avoid Over-Engineering
❌ Don't add Redux for a boolean toggle.
❌ Don't wrap every value in Context — it causes unnecessary re-renders.
✅ Default to `useState`. Extract to `useReducer` when state logic is complex (3+ related values with interdependent updates).
## Performance
### Memoization — Only When Needed
```tsx
// Profile first. Then memoize.
const sorted = useMemo(() => expensiveSort(items), [items]);
const handleClick = useCallback(() => doThing(id), [id]);
```
Rules:
- `useMemo` for **computed values** from arrays/objects that trigger downstream effects.
- `useCallback` when passing callbacks to memoized children.
- `React.memo` on components that re-render with the same props frequently.
- **Don't** wrap everything — the overhead of comparison can exceed the render cost.
### List Rendering
```tsx
// Always use a stable, unique key
{items.map((item) => <ListItem key={item.id} item={item} />)}
// For static lists, key=index is acceptable. For dynamic lists, never.
// Extract list item into a memoized component if re-renders are expensive.
```
## Error Boundaries
Class component only (React <19). Catch render-phase errors. Cannot catch:
- Event handlers (use try/catch)
- Async code (use try/catch)
- SSR errors
- Errors in the boundary itself
```tsx
class ErrorBoundary extends React.Component<{ fallback: ReactNode }, { error: Error | null }> {
state = { error: null };
static getDerivedStateFromError(error: Error) { return { error }; }
render() {
if (this.state.error) return this.props.fallback;
return this.props.children;
}
}
```
React 19 introduces `useError` hook as an alternative.
## Directory Structure Convention
```
components/ → shared/reusable UI
ui/ → primitive atoms (Button, Input, Modal)From UgochukwuChidera/Opencode-Agents, GPL-3.0.
More from UgochukwuChidera/Opencode-Agents
- 0.474score
tool-preference
UgochukwuChidera
Use when deciding whether to use a plugin tool or bash.
SkillCFreshness: CClaude Code +9 - 0.474score
grill-with-docs
UgochukwuChidera
Use when you need to conduct a structured design interview AND persist the results as documentation.
SkillCFreshness: CClaude Code +9 - 0.474score
segmented-prompt-execution
UgochukwuChidera
Use when executing prompts sequentially from a build plan.
SkillCFreshness: CClaude Code +9 - 0.474score
grill-me
UgochukwuChidera
Use when conducting structured design interviews to discover shared language, uncover implicit assumptions, and refine project terminology before planning or…
SkillCFreshness: CClaude Code +9 - 0.474score
api-design
UgochukwuChidera
Use when designing REST or GraphQL APIs, defining endpoints, request/response shapes, error responses, pagination, versioning, authentication, or OpenAPI specs.
SkillCFreshness: CClaude Code +9 - 0.474score
authentication-authorization
UgochukwuChidera
Use when implementing auth — login, registration, session management, JWT, OAuth, password hashing, RBAC, API keys, MFA, and security headers.
SkillCFreshness: CClaude Code +9 - 0.474score
database-data-layer
UgochukwuChidera
Use when designing or implementing database schemas, data models, migrations, seeding, and query layers.
SkillCFreshness: CClaude Code +9 - 0.474score
deployment-devops
UgochukwuChidera
Use when setting up deployment, Docker, CI/CD, environment configuration, hosting, and infrastructure.
SkillCFreshness: CClaude Code +9 - 0.474score
design-system-implementation
UgochukwuChidera
Use when implementing UI components from design token specifications.
SkillCFreshness: CClaude Code +9 - 0.474score
error-handling
UgochukwuChidera
Use when handling errors, building error boundaries, designing error responses, or adding logging/observability.
SkillCFreshness: CClaude Code +9 - 0.474score
meta-architect-patterns
UgochukwuChidera
Use when executing a Meta-Architect build plan from plan.json.
SkillCFreshness: CClaude Code +9 - 0.474score
security-review
UgochukwuChidera
Use when reviewing code for security vulnerabilities, auditing authentication/authorization, handling secrets, or assessing OWASP Top 10 risks.
SkillCFreshness: CClaude Code +9
Signals
- Stars
- 0
- Forks
- 0
- Open issues
- 0
- Last commit (this folder)
- Jul 6, 2026 (3 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- GPL-3.0
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from UgochukwuChidera
- 0.474score
grill-with-docs
UgochukwuChidera
Use when you need to conduct a structured design interview AND persist the results as documentation.
SkillCFreshness: CClaude Code +9 - 0.474score
grill-me
UgochukwuChidera
Use when conducting structured design interviews to discover shared language, uncover implicit assumptions, and refine project terminology before planning or…
SkillCFreshness: CClaude Code +9 - 0.474score
api-design
UgochukwuChidera
Use when designing REST or GraphQL APIs, defining endpoints, request/response shapes, error responses, pagination, versioning, authentication, or OpenAPI specs.
SkillCFreshness: CClaude Code +9 - 0.474score
authentication-authorization
UgochukwuChidera
Use when implementing auth — login, registration, session management, JWT, OAuth, password hashing, RBAC, API keys, MFA, and security headers.
SkillCFreshness: CClaude Code +9 - 0.474score
database-data-layer
UgochukwuChidera
Use when designing or implementing database schemas, data models, migrations, seeding, and query layers.
SkillCFreshness: CClaude Code +9 - 0.474score
deployment-devops
UgochukwuChidera
Use when setting up deployment, Docker, CI/CD, environment configuration, hosting, and infrastructure.
SkillCFreshness: CClaude Code +9
Cite this page
react-patterns skill. Agent Mart. https://agentmart.dev/skills/ugochukwuchidera-react-patterns (last updated 2026-10-24)