react-best-practices

Codify React component best practices for TypeScript and JavaScript codebases.

1|Updated Apr 29, 2026
One-click install
npx skills add https://github.com/firstsun-dev/yao-agent-skills --skill react-best-practices-firstsun-dev
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: react-best-practices
Source: https://github.com/firstsun-dev/yao-agent-skills/tree/main/external/develop/frontend/react-best-practices
Command: npx skills add https://github.com/firstsun-dev/yao-agent-skills --skill react-best-practices-firstsun-dev

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Guides developers to write robust, maintainable React components by codifying recommended patterns and avoiding common pitfalls.

Core Features & Use Cases

  • Clear guidance on when to use effects, memoization, and event handling to optimize UI logic.
  • Patterns for controlled vs uncontrolled components, composition, and the use of Context to manage global state.
  • Real-world scenarios including UI component design, data fetching, performance tuning, and TypeScript integration.

Quick Start

Refactor a sample React component to apply the documented patterns, such as replacing derived state with render-time calculations and memoizing expensive computations.

Frequently Asked Questions about react-best-practices

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

FAQPage Schema
What are the best practices for managing React hooks and effects in TypeScript?

React best practices for hooks and effects involve standardizing usage conventions to avoid common pitfalls. This approach codifies when to use effects, memoization, and event handling to optimize UI logic and ensure maintainable component development across TypeScript projects.

How do I refactor a React component to avoid derived state and improve performance?

To refactor a React component for performance, replace derived state with render-time calculations and memoize expensive computations. Applying these documented patterns standardizes development and reduces unexpected behavior during data fetching and UI rendering.

Does this React best practices guidance work with both JavaScript and TypeScript codebases?

Yes, these React best practices apply across both TypeScript and JavaScript projects. The patterns cover TypeScript integration, component composition, and global state management using Context, ensuring robust applications regardless of the chosen language.

When should I use controlled vs uncontrolled components in React?

Controlled vs uncontrolled component patterns in React are determined by your specific state management needs. This guidance codifies clear rules for component composition and Context usage, helping you manage global state consistently and avoid common UI logic pitfalls.

How can I enforce consistent React patterns during code reviews and onboarding?

You can enforce consistent React patterns during code reviews and onboarding by codifying recommended practices for component development. This provides clear documentation on hooks conventions, effects usage, and performance optimization to reduce surprises in modern codebases.