What problem does it solve?
This skill consolidates React best practices to reduce bugs and anti-patterns in component code, providing a clear framework for writing and reviewing React components with confidence.
Core Features & Use Cases
- Escape hatch principle: use Effects to synchronize with external systems, not for core logic.
- When to use Effects: guidance on data fetching, subscriptions, event listeners, and external integrations.
- Dependency discipline: proper use of dependency arrays, updater patterns, and avoiding stale closures.
- useEffectEvent and callback stability: techniques to stabilize non-reactive logic and event handlers.
- Custom hooks and component patterns: focused, reusable hooks; controlled vs. uncontrolled components; composition over prop drilling.
- Anti-patterns to avoid: derived state during render, excessive effect chains, and recreating objects inside effects.
Quick Start
Review the core principle (effects as escape hatches) and apply the guidelines when writing or refactoring React components (.tsx/.jsx files with React imports). Pair this skill withtypescript-best-practices for TS projects, and progressively adopt the documented patterns in your codebase during code reviews and onboarding.