react

Writes and audits React components against the rendering model, Rules of Hooks, and composition patterns.

Updated Nov 20, 2025
One-click install
npx skills add https://github.com/apuya/react-basics-ui --skill react-apuya
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: react
Source: https://github.com/apuya/react-basics-ui/tree/main/.claude/skills/react
Command: npx skills add https://github.com/apuya/react-basics-ui --skill react-apuya

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? React codebases accumulate subtle bugs: unnecessary useEffect calls, stale closures, missing hook dependencies, broken list keys, state mirroring props, and wasted re-renders. This Skill engineers and reviews React code against the library's actual rendering model so components stay pure, hooks stay legal, and state lives in the right place. ## Core Features & Use Cases - Component authoring: Write components as pure functions of props and state, with hooks at the top level, effects only for external synchronization, and state at its lowest common owner. - Bug auditing: Detect and fix stale closures, suppressed exhaustive-deps warnings, index-as-key on reorderable lists, derived state stored in useState, and effects that belong in event handlers. - Performance discipline: Apply React.memo, useMemo, and useCallback only when justified by profiling, memoized children, or hook dependencies — while respecting this library's deliberate component-level memo convention. - Use Case: Ask it to review a component where a dropdown resets unexpectedly; it will identify state mirrored from a prop and fix it with a key-based remount or lifted state. ## Quick Start Ask the assistant to review your React component for unnecessary useEffect calls, stale closures, and missing hook dependencies.

Frequently Asked Questions about react

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I fix unnecessary useEffect calls in React?

Most unnecessary effects derive state from props or run logic belonging to a user action. Compute derived values directly in render, move user-action logic into event handlers, and reserve useEffect for synchronizing with external systems like subscriptions, timers, or DOM APIs.

How to fix stale closure and exhaustive-deps warnings in React hooks?

Stale closures happen when an effect or callback references a reactive value missing from its dependency array. Add every reactive value to the deps array or restructure with a functional setState updater; suppressing react-hooks/exhaustive-deps hides the bug rather than fixing it.

When should I use React.memo, useMemo, and useCallback?

Use them only when a profiler shows a real bottleneck, a memoized child receives inline objects or functions, or a value needs referential stability as a hook dependency. Default to no memoization since each call adds comparison cost and dependency maintenance.

Why does my React list break when using array index as key?

Index keys break when a list sorts, filters, reorders, or inserts items, because React matches elements by key across renders and reuses the wrong component state. Use a stable id from the data; index keys are acceptable only for append-only lists.

When should I lift state up versus use React Context?

Lift state to the lowest common owner when two siblings need to share it. Use Context only for values needed at many depths like theme or current user; two or three levels of prop drilling is not a Context use case, and every consumer re-renders when the value changes.