react-best-practices

Review React .tsx and .jsx files for effect and hook best practices.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/awfixers-stuff/opencode-config --skill react-best-practices-awfixers-stuff
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: react-best-practices
Source: https://github.com/awfixers-stuff/opencode-config/tree/main/skills/react-best-practices
Command: npx skills add https://github.com/awfixers-stuff/opencode-config --skill react-best-practices-awfixers-stuff

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps developers read, write, and refactor React components by reducing incorrect or overused effects, preventing common hook mistakes, and promoting patterns that produce predictable, testable components.

Core Features & Use Cases

  • Effect Guidance: When to use effects versus event handlers, memoization, or render-time calculations.
  • Hook & Ref Patterns: Recommendations for useMemo, useEffectEvent, refs, updater functions, and useImperativeHandle.
  • Component Design: Advice on controlled vs uncontrolled components, composition over prop drilling, key-based resets, cleanup, and linter-friendly custom hooks.
  • Use Case: Use this Skill during code review or refactoring to convert effect-heavy code into handler-driven, memoized, and ref-focused implementations and to pair React work with TypeScript patterns.

Quick Start

Review the attached React .tsx or .jsx file and recommend refactorings to remove unnecessary useEffect usage, apply appropriate hooks and refs, and align with TypeScript patterns.

Frequently Asked Questions about react-best-practices

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

FAQPage Schema
When should I use useEffect instead of event handlers or useMemo in React?▼

Use effects only for synchronizing with external systems; prefer useMemo for data transformation and event handlers for user actions to ensure predictable React component behavior.

How do I refactor React components to remove unnecessary effect usage?▼

Refactor components by replacing effect-driven state updates with event handlers, applying updater functions, and using refs for mutable values to convert effect-heavy code into handler-driven implementations.

Does this refactoring guidance work with TypeScript and .tsx React files?▼

Yes, the guidance applies to .tsx and .jsx files with React imports, pairing React refactoring and hook patterns with TypeScript conventions for linter-friendly dependency handling.

What are the best practices for managing refs and custom hooks in React?▼

Best practices include using useImperativeHandle for controlled ref exposure, applying useEffectEvent for non-reactive logic, and ensuring custom hooks include proper cleanup and linter-friendly dependency arrays.

Why does my React component re-render excessively due to incorrect hook dependencies?▼

Excessive re-renders often stem from effect misuse. Applying memoization with useMemo, using refs for mutable values, and aligning dependency arrays with linter rules minimizes unnecessary render cycles.

Can I get advice on controlled vs uncontrolled component design patterns?▼

Yes, component design guidance covers choosing between controlled and uncontrolled patterns, favoring composition over prop drilling, and implementing key-based resets for predictable component behavior.