react

SKILL.md

React Best Practices

Official React 18/19 guidelines - Hooks, Server Components, Performance, Patterns

Core Principles

  1. ALWAYS Use Hooks - Functional components with hooks over class components
  2. Server Components by Default - Client components only when needed ("use client")
  3. Proper Dependencies - Always specify correct dependency arrays
  4. Cleanup Effects - Return cleanup functions from useEffect
  5. Avoid Premature Optimization - Use React.memo, useMemo, useCallback wisely

React Hooks - Complete Guide

useState - State Management

✅ Good: Basic useState Patterns

import { useState } from 'react'
Installs
1
First Seen
Jun 4, 2026
react from modelscope.cn