[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M73AT6PK7FDTS7J7RSQ5STDC":3,"skill-same:01M73AT6PK7FDTS7J7RSQ5STDC":68},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":16,"sourceHtmlUrl":17,"categories":18,"keywords":19,"publishedAt":20,"linkOnly":21,"markdownContent":22,"markdownBody":23,"frontMatter":24,"refName":33,"commitSha":34,"skillDirectory":35,"forksCount":36,"repositoryHtmlUrl":37,"repositoryHomepageUrl":38,"ownerHtmlUrl":39,"ownerBlogUrl":40,"ownerDescription":41,"updatedAt":42,"install":43,"resources":56},"01M73AT6PK7FDTS7J7RSQ5STDC","react-development",null,"React 19+ with TypeScript — hooks, custom hooks, state management (useState\u002FuseReducer\u002FuseContext), React Query\u002FSWR, Tailwind CSS, performance. Use when building React components, apps, or optimizing renders.","bg-szy\u002FTOP-SKILLS","bg-szy","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F106576190?v=4","01M73A4E8KPV67SFXRY8XZGNBX","ShuZhiyong","01M73A4E96MQ294MHM74TZBVQD",6,"MIT","https:\u002F\u002Fgithub.com\u002Fbg-szy\u002FTOP-SKILLS\u002Fblob\u002Fmaster\u002Fskills\u002Fagent-skills\u002Freact-development\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fbg-szy\u002FTOP-SKILLS\u002Fblob\u002Fmaster\u002Fskills\u002Fagent-skills\u002Freact-development\u002FSKILL.md",[],[],"2026-11-11 15:11:14",false,"---\nname: react-development\nversion: \"2.0\"\nlast_updated: 2026-09-08\ntags: [react, development, testing, quality, automation]\ndescription: \"React 19+ with TypeScript — hooks, custom hooks, state management (useState\u002FuseReducer\u002FuseContext), React Query\u002FSWR, Tailwind CSS, performance. Use when building React components, apps, or optimizing renders.\"\n---\n# React Development\n\n> Optimized for React 19+, TypeScript 5.5+, React Testing Library 16+, and modern server-first app architectures.\n\nExpert guidance for building high-quality React applications with React 19+, modern hooks, TypeScript, and best practices following official React documentation at https:\u002F\u002Freact.dev.\n\n- Leverage native parallel subagent dispatch and 200k+ context windows where available.\n\n\n## Component Review Rubric Reference\n\nApply the shared [Component Review Rubric](..\u002Ffrontend-design\u002FSKILL.md#component-review-rubric) before approving React components, then run the React-specific checks below.\n\n\u003C!-- MCP:START -->\n\n\u003C!-- PORTABILITY:START -->\n## Cross-Client Portability\n\nThis skill is written to stay usable across GitHub Copilot, Claude Code, and Codex.\n\n- GitHub Copilot: keep the folder in a Copilot-visible skill path or wrap the\n  workflow in project instructions when folder discovery is unavailable.\n- Claude Code: keep the folder in a local skills directory or a compatible plugin source.\n- Codex: install or sync the folder into\n  `$CODEX_HOME\u002Fskills\u002Freact-development` and restart Codex after major changes.\n\n\u003C!-- PORTABILITY:END -->\n\n## MCP Availability And Fallback\n\nPreferred MCP Server: None required\n\n- Fallback prompt: \"Use the React Development skill without MCP. Rely on its local instructions, bundled resources, standard shell or editor tools, and direct verification. Show the evidence used before concluding.\"\n- Do not claim an MCP operation was used when the active host does not expose it.\n- Treat local files, tests, rendered outputs, logs, or screenshots as the fallback evidence path.\n\n\u003C!-- MCP:END -->\n\n## Anti-Patterns\n\n- Fetching everything in client effects by default: Server-first data loading is usually simpler, faster, and easier to cache.\n- Adding memoization before profiling: Manual optimizations can create stale-prop bugs and hide simpler design fixes.\n- Skipping keyboard and accessible-name review: A component is not done if only pointer users can operate it reliably.\n\n## Verification Protocol\n\nBefore claiming \"skill applied successfully\":\n\n1. Pass\u002Ffail: The React Development guidance is tied to a concrete route, component, screen, or design artifact.\n2. Pass\u002Ffail: Component states cover loading, empty, error, success, and responsive breakpoints where applicable.\n3. Pass\u002Ffail: Accessibility, visual hierarchy, and interaction behavior are reviewed against the shared component rubric.\n4. Pressure-test scenario: Review the component on a narrow mobile viewport, keyboard-only path, and slow-loading state.\n5. Success metric: Zero generic UI approval; every approval cites rendered behavior or source evidence.\n\n## Before and After Example\n\n```tsx\n\u002F\u002F Before\n'use client';\n\nexport function Dashboard() {\n  const [orders, setOrders] = useState\u003COrder[]>([]);\n  useEffect(() => {\n    fetch('\u002Fapi\u002Forders').then((r) => r.json()).then(setOrders);\n  }, []);\n  return \u003COrdersTable orders={orders} \u002F>;\n}\n\n\u002F\u002F After\nexport async function Dashboard() {\n  const orders = await getOrders();\n  return \u003COrdersTable orders={orders} \u002F>;\n}\n```\n\nLets the server boundary load data directly and keeps the client side focused on interaction, not bootstrapping.\n\n## Activation Conditions\n\nUse symptom -> action triggers: when one matches, apply this skill and verify with the protocol below.\n\n**Core React Development:**\n- Building React components with hooks and TypeScript\n- Setting up React applications (Vite, Next.js, CRA)\n- Working with React Router for navigation\n- Implementing forms and user input handling\n- Creating responsive layouts and component architecture\n\n**State Management & Data:**\n- Managing state (useState, useReducer, useContext)\n- Implementing React Query or SWR for data fetching\n- Building custom hooks for reusable stateful logic\n- Creating Context providers for global state\n- Implementing React 19 Server Components (if using Next.js)\n\n**Component Patterns:**\n- Creating reusable UI components with proper composition\n- Building forms with React Hook Form and Zod validation\n- Implementing modal dialogs and overlays\n- Creating custom React hooks (useDebounce, useLocalStorage)\n- Designing responsive variants for different screen sizes\n\n**Performance & Quality:**\n- Optimizing React app performance\n- Implementing memoization (useMemo, useCallback)\n- Code splitting and lazy loading\n- Writing tests with React Testing Library\n- Ensuring accessibility compliance (ARIA, keyboard nav)\n\n## Part 1: React Fundamentals\n\n### Project Structure\n\n**Recommended Structure:**\n```\nsrc\u002F\n├── components\u002F          # Reusable UI components\n│   ├── ui\u002F            # Primitives (Button, Input, Modal)\n│   ├── forms\u002F          # Form components\n│   └── layout\u002F         # Layout components\n├── hooks\u002F              # Custom hooks\n├── contexts\u002F            # Context providers\n├── pages\u002F              # Page components\n├── lib\u002F                # Utilities, API clients\n├── types\u002F              # TypeScript types\n├── styles\u002F              # Global styles\n└── main.jsx            # App entry point\n```\n\n### Component Architecture\n\n#### Functional Components (React 19 Standard)\n\n```typescript\ninterface ButtonProps {\n  variant: 'primary' | 'secondary' | 'danger';\n  size?: 'sm' | 'md' | 'lg';\n  onClick: (event: React.MouseEvent\u003CHTMLButtonElement>) => void;\n  children: React.ReactNode;\n  disabled?: boolean;\n  isLoading?: boolean;\n}\n\nexport function Button({\n  variant = 'primary',\n  size = 'md',\n  onClick,\n  children,\n  disabled = false,\n  isLoading = false,\n}: ButtonProps) {\n  const baseClasses = 'rounded-lg font-medium transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2';\n\n  const variantClasses = {\n    primary: 'bg-blue-600 hover:bg-blue-700 text-white focus:ring-blue-500',\n    secondary: 'bg-gray-100 hover:bg-gray-200 text-gray-900 focus:ring-gray-500',\n    danger: 'bg-red-600 hover:bg-red-700 text-white focus:ring-red-500',\n  };\n\n  const sizeClasses = {\n    sm: 'px-3 py-1.5 text-sm',\n    md: 'px-4 py-2 text-base',\n    lg: 'px-5 py-2.5 text-lg',\n  };\n\n  return (\n    \u003Cbutton\n      disabled={disabled || isLoading}\n      onClick={onClick}\n      className={`${baseClasses} ${variantClasses[variant]} ${sizeClasses[size]}`}\n    >\n      {isLoading ? 'Loading...' : children}\n    \u003C\u002Fbutton>\n  );\n}\n```\n\n#### Generic Components\n\n```typescript\ninterface ListProps\u003CT> {\n  items: T[];\n  renderItem: (item: T, index: number) => React.ReactNode;\n  keyExtractor: (item: T) => string;\n  emptyMessage?: string;\n}\n\nfunction List\u003CT>({ items, renderItem, keyExtractor, emptyMessage = 'No items' }: ListProps\u003CT>) {\n  return (\n    \u003Cul>\n      {items.length === 0 ? (\n        \u003Cli>{emptyMessage}\u003C\u002Fli>\n      ) : (\n        items.map((item, index) => (\n          \u003Cli key={keyExtractor(item)}>\n            {renderItem(item, index)}\n          \u003C\u002Fli>\n        ))\n      )}\n    \u003C\u002Ful>\n  );\n}\n\n\u002F\u002F Usage\n\u003CList\n  items={users}\n  renderItem={(user) => `${user.firstName} ${user.lastName}`}\n  keyExtractor={(user) => user.id}\n\u002F>\n```\n\n### Component Patterns\n\n**Composition over Inheritance:**\n\n```typescript\n\u002F\u002F ✅ GOOD - Component composition\nfunction Card({ children }: { children: React.ReactNode }) {\n  return (\n    \u003Cdiv className=\"border rounded-lg p-4 shadow-sm\">\n      {children}\n    \u003C\u002Fdiv>\n  );\n}\n\nfunction CardHeader({ children }: { children: React.ReactNode }) {\n  return (\n    \u003Cdiv className=\"font-bold text-lg mb-2 border-b pb-2\">\n      {children}\n    \u003C\u002Fdiv>\n  );\n}\n\nfunction CardBody({ children }: { children: React.ReactNode }) {\n  return \u003Cdiv>{children}\u003C\u002Fdiv>;\n}\n\n\u002F\u002F Usage\n\u003CCard>\n  \u003CCardHeader>Title\u003C\u002FCardHeader>\n  \u003CCardBody>Content here\u003C\u002FCardBody>\n\u003C\u002FCard>\n\n\u002F\u002F ❌ BAD - Inheritance or complex props\nfunction Card({ renderHeader, renderBody, renderFooter }: { ... }) { ... }\n```\n\n**Presentational vs Container Components:**\n\n```typescript\n\u002F\u002F Presentational - UI only, doesn't fetch data\ninterface UserCardProps {\n  user: User;\n  onStatusChange: (status: string) => void;\n}\n\nfunction UserCard({ user, onStatusChange }: UserCardProps) {\n  return (\n    \u003Cdiv>\n      \u003Ch3>{user.name}\u003C\u002Fh3>\n      \u003Cselect value={user.status} onChange={(e) => onStatusChange(e.target.value)}>\n        \u003Coption value=\"active\">Active\u003C\u002Foption>\n        \u003Coption value=\"inactive\">Inactive\u003C\u002Foption>\n      \u003C\u002Fselect>\n    \u003C\u002Fdiv>\n  );\n}\n\n\u002F\u002F Container - Fetches data, passes to presentational\nfunction UserContainer() {\n  const { data: user, mutate: updateStatus } = useUser(userId);\n\n  return user ? (\n    \u003CUserCard user={user} onStatusChange={(status) => updateStatus({ status })} \u002F>\n  ) : (\n    \u003CLoadingSpinner \u002F>\n  );\n}\n```\n\n---\n\n## Part 2: Hooks Patterns\n\n### Built-in Hooks Mastery\n\n#### useState - For Local State\n\n```typescript\n\u002F\u002F Simple state\nfunction Counter() {\n  const [count, setCount] = useState(0);\n\n  return (\n    \u003Cdiv>\n      \u003Cspan>{count}\u003C\u002Fspan>\n      \u003Cbutton onClick={() => setCount(c => c + 1)}>Increment\u003C\u002Fbutton>\n    \u003C\u002Fdiv>\n  );\n}\n\n\u002F\u002F Complex state - use useReducer instead\nfunction Form() {\n  type FormState = {\n    name: string;\n    email: string;\n    submitted: boolean;\n  };\n\n  const [form, setForm] = useState\u003CFormState>({\n    name: '',\n    email: '',\n    submitted: false,\n  });\n\n  const updateField = (field: keyof FormState) => (\n    e: React.ChangeEvent\u003CHTMLInputElement>\n  ) => setForm(f => ({ ...f, [field]: e.target.value }));\n\n  return (\n    \u003Cform>\n      \u003Cinput value={form.name} onChange={updateField('name')} \u002F>\n      \u003Cinput value={form.email} onChange={updateField('email')} \u002F>\n    \u003C\u002Fform>\n  );\n}\n```\n\n#### useReducer - For Complex State\n\n```typescript\ntype Action =\n  | { type: 'ADD_TODO'; payload: string }\n  | { type: 'TOGGLE_TODO'; payload: number }\n  | { type: 'DELETE_TODO'; payload: number };\n\ntype TodoState = {\n  items: Array\u003C{ id: number; text: string; completed: boolean }>;\n};\n\nfunction todosReducer(state: TodoState, action: Action): TodoState {\n  switch (action.type) {\n    case 'ADD_TODO':\n      return {\n        items: [\n          ...state.items,\n          { id: Date.now(), text: action.payload, completed: false },\n        ],\n      };\n    case 'TOGGLE_TODO':\n      return {\n        items: state.items.map((item) =>\n          item.id === action.payload ? { ...item, completed: !item.completed } : item\n        ),\n      };\n    case 'DELETE_TODO':\n      return {\n        items: state.items.filter((item) => item.id !== action.payload),\n      };\n    default:\n      return state;\n  }\n}\n\nfunction TodoApp() {\n  const [state, dispatch] = useReducer(todosReducer, { items: [] });\n\n  return (\n    \u003Cdiv>\n      \u003CToDoList items={state.items} onToggle={(id) => dispatch({ type: 'TOGGLE_TODO', payload: id })} \u002F>\n    \u003C\u002Fdiv>\n  );\n}\n```\n\n#### useEffect - For Side Effects\n\n```typescript\nfunction UserProfile({ userId }: { userId: string }) {\n  const [user, setUser] = useState\u003CUser | null>(null);\n\n  \u002F\u002F ✅ GOOD - Run on mount and when userId changes\n  useEffect(() => {\n    let cancelled = false;\n\n    async function fetchUser() {\n      const userData = await api.getUser(userId);\n      if (!cancelled) {\n        setUser(userData);\n      }\n    }\n\n    fetchUser();\n\n    return () => {\n      cancelled = true; \u002F\u002F Cleanup to prevent state updates after unmount\n    };\n  }, [userId]);\n\n  \u002F\u002F ✅ GOOD - Document title update\n  useEffect(() => {\n    if (user) {\n      document.title = `${user.name} - Profile`;\n    }\n    return () => {\n      document.title = 'App';\n    };\n  }, [user]);\n\n  if (!user) return \u003CLoadingSkeleton \u002F>;\n\n  return (\n    \u003Cdiv>\n      \u003Ch1>{user.name}\u003C\u002Fh1>\n      {\u002F* ... *\u002F}\n    \u003C\u002Fdiv>\n  );\n}\n```\n\n#### useContext - For Global State\n\n```typescript\n\u002F\u002F Context creation\ntype ThemeContextType = {\n  theme: 'light' | 'dark';\n  toggleTheme: () => void;\n};\n\nconst ThemeContext = createContext\u003CThemeContextType | null>(null);\n\n\u002F\u002F Provider component\nexport function ThemeProvider({ children }: { children: React.ReactNode }) {\n  const [theme, setTheme] = useState\u003C'light' | 'dark'>('light');\n\n  const toggleTheme = () => setTheme(t => t === 'light' ? 'dark' : 'light');\n\n  return (\n    \u003CThemeContext.Provider value={{ theme, toggleTheme }}>\n      {children}\n    \u003C\u002FThemeContext.Provider>\n  );\n}\n\n\u002F\u002F Custom hook for using context\nexport function useTheme() {\n  const context = useContext(ThemeContext);\n  if (!context) {\n    throw new Error('useTheme must be used within ThemeProvider');\n  }\n  return context;\n}\n\n\u002F\u002F Usage in component\nfunction ThemedButton() {\n  const { theme, toggleTheme } = useTheme();\n\n  return (\n    \u003Cbutton\n      onClick={toggleTheme}\n      className={theme === 'dark' ? 'bg-gray-800 text-white' : 'bg-white text-black'}\n    >\n      Toggle {theme} theme\n    \u003C\u002Fbutton>\n  );\n}\n```\n\n### Performance Hooks\n\n#### useMemo - Memoize Expensive Computations\n\n```typescript\nfunction ProductList({ products }: { products: Product[] }) {\n  \u002F\u002F ✅ GOOD - Memoize expensive calculation\n  const sortedProducts = useMemo(() => {\n    return [...products].sort((a, b) => a.price - b.price);\n  }, [products]);\n\n  const expensiveAnalysis = useMemo(() => {\n    \u002F\u002F Only recompute when prices change\n    const avgPrice = products.reduce((sum, p) => sum + p.price, 0) \u002F products.length;\n    const maxPrice = Math.max(...products.map(p => p.price));\n    return { avgPrice, maxPrice };\n  }, [products]);\n\n  return (\n    \u003Cdiv>\n      \u003CStatsCard data={expensiveAnalysis} \u002F>\n      \u003CProductCards products={sortedProducts} \u002F>\n    \u003C\u002Fdiv>\n  );\n}\n```\n\n#### useCallback - Memoize Functions\n\n```typescript\nfunction ParentComponent() {\n  const [items, setItems] = useState\u003CItem[]>([]);\n\n  \u002F\u002F ✅ GOOD - Memoize callback to prevent child re-renders\n  const handleItemAdd = useCallback((item: Item) => {\n    setItems(prev => [...prev, item]);\n  }, []);\n\n  const handleItemRemove = useCallback((id: string) => {\n    setItems(prev => prev.filter(item => item.id !== id));\n  }, []);\n\n  return (\n    \u003Cdiv>\n      \u003CAddItemForm onAdd={handleItemAdd} \u002F>\n      \u003CItemList items={items} onRemove={handleItemRemove} \u002F>\n    \u003C\u002Fdiv>\n  );\n}\n\n\u002F\u002F Child component wrapped in React.memo\nconst ItemList = React.memo(function ItemList({\n  items,\n  onRemove,\n}: {\n  items: Item[];\n  onRemove: (id: string) => void;\n}) {\n  return (\n    \u003Cul>\n      {items.map(item => (\n        \u003Cli key={item.id}>\n          {item.name}\n          \u003Cbutton onClick={() => onRemove(item.id)}>Remove\u003C\u002Fbutton>\n        \u003C\u002Fli>\n      ))}\n    \u003C\u002Ful>\n  );\n});\n```\n\n---\n\n## Part 3: Custom Hooks\n\n### useDebounce\n\nDebounce rapid value changes, useful for search inputs:\n\n```typescript\nimport { useState, useEffect } from 'react';\n\nfunction useDebounce\u003CT>(value: T, delay: number = 500): T {\n  const [debouncedValue, setDebouncedValue] = useState\u003CT>(value);\n\n  useEffect(() => {\n    const handler = setTimeout(() => {\n      setDebouncedValue(value);\n    }, delay);\n\n    return () => {\n      clearTimeout(handler);\n    };\n  }, [value, delay]);\n\n  return debouncedValue;\n}\n\n\u002F\u002F Usage\nfunction SearchBar() {\n  const [query, setQuery] = useState('');\n  const debouncedQuery = useDebounce(query, 300);\n\n  useEffect(() => {\n    \u002F\u002F This only runs 300ms after user stops typing\n    if (debouncedQuery) {\n      performSearch(debouncedQuery);\n    }\n  }, [debouncedQuery]);\n\n  return (\n    \u003Cinput\n      type=\"text\"\n      value={query}\n      onChange={(e) => setQuery(e.target.value)}\n      placeholder=\"Search...\"\n    \u002F>\n  );\n}\n```\n\n### useLocalStorage\n\nPersist state to localStorage:\n\n```typescript\nfunction useLocalStorage\u003CT>(key: string, initialValue: T) {\n  const [storedValue, setStoredValue] = useState\u003CT>(() => {\n    try {\n      const item = window.localStorage.getItem(key);\n      return item ? JSON.parse(item) : initialValue;\n    } catch (error) {\n      console.error(`Error reading localStorage key \"${key}\":`, error);\n      return initialValue;\n    }\n  });\n\n  const setValue = (value: T | ((val: T) => T)) => {\n    try {\n      const valueToStore = value instanceof Function ? value(storedValue) : value;\n      setStoredValue(valueToStore);\n      window.localStorage.setItem(key, JSON.stringify(valueToStore));\n    } catch (error) {\n      console.error(`Error setting localStorage key \"${key}\":`, error);\n    }\n  };\n\n  return [storedValue, setValue] as const;\n}\n\n\u002F\u002F Usage\nfunction ThemeToggle() {\n  const [theme, setTheme] = useLocalStorage\u003C'light' | 'dark'>('theme', 'light');\n\n  return (\n    \u003Cbutton onClick={() => setTheme(theme === 'light' ? 'dark' : 'light')}>\n      Current theme: {theme}\n    \u003C\u002Fbutton>\n  );\n}\n```\n\n### useToggle\n\nToggle boolean state with useful utilities:\n\n```typescript\nfunction useToggle(initialValue: boolean = false) {\n  const [value, setValue] = useState(initialValue);\n\n  const toggle = useCallback(() => setValue(v => !v), []);\n  const setTrue = useCallback(() => setValue(true), []);\n  const setFalse = useCallback(() => setValue(false), []);\n\n  return { value, toggle, setTrue, setFalse, setValue } as const;\n}\n\n\u002F\u002F Usage\nfunction ModalExample() {\n  const { value: isOpen, toggle, setFalse: close } = useToggle(false);\n\n  return (\n    \u003C>\n      \u003Cbutton onClick={toggle}>Open Modal\u003C\u002Fbutton>\n      \u003CModal isOpen={isOpen} onClose={close}>\n        \u003Cp>Modal content\u003C\u002Fp>\n      \u003C\u002FModal>\n    \u003C\u002F>\n  );\n}\n```\n\n### useFetch\n\nData fetching with loading and error states:\n\n```typescript\ntype UseFetchResult\u003CT> = {\n  data: T | null;\n  loading: boolean;\n  error: Error | null;\n  refetch: () => Promise\u003Cvoid>;\n};\n\nfunction useFetch\u003CT>(url: string): UseFetchResult\u003CT> {\n  const [data, setData] = useState\u003CT | null>(null);\n  const [loading, setLoading] = useState(true);\n  const [error, setError] = useState\u003CError | null>(null);\n\n  const fetchData = useCallback(async () => {\n    setLoading(true);\n    setError(null);\n\n    try {\n      const response = await fetch(url);\n      const jsonData = await response.json();\n      setData(jsonData);\n    } catch (err) {\n      setError(err as Error);\n    } finally {\n      setLoading(false);\n    }\n  }, [url]);\n\n  useEffect(() => {\n    fetchData();\n  }, [fetchData]);\n\n  return { data, loading, error, refetch: fetchData };\n}\n\n\u002F\u002F Usage\nfunction UserProfile({ userId }: { userId: string }) {\n  const { data: user, loading, error } = useFetch\u003CUser>(`\u002Fapi\u002Fusers\u002F${userId}`);\n\n  if (loading) return \u003CLoadingSpinner \u002F>;\n  if (error) return \u003CErrorAlert message={error.message} \u002F>;\n\n  return (\n    \u003Cdiv>\n      \u003Ch1>{user?.name}\u003C\u002Fh1>\n      \u003Cp>{user?.email}\u003C\u002Fp>\n    \u003C\u002Fdiv>\n  );\n}\n```\n\n---\n\n## Part 4: Forms & Validation\n\n### React Hook Form with Zod\n\n```typescript\nimport { useForm } from 'react-hook-form';\nimport { zodResolver } from '@hookform\u002Fresolvers\u002Fzod';\nimport { z } from 'zod';\n\n\u002F\u002F Zod schema for validation\nconst formSchema = z.object({\n  name: z.string().min(2, 'Name must be at least 2 characters'),\n  email: z.string().email('Invalid email address'),\n  age: z.number().min(18, 'Must be at least 18'),\n  subscribe: z.boolean().default(false),\n});\n\ntype FormData = z.infer\u003Ctypeof formSchema>;\n\nfunction UserForm() {\n  const {\n    register,\n    handleSubmit,\n    formState: { errors, isSubmitting },\n  } = useForm\u003CFormData>({\n    resolver: zodResolver(formSchema),\n  });\n\n  const onSubmit = async (data: FormData) => {\n    try {\n      await api.createUser(data);\n      alert('User created successfully!');\n    } catch (error) {\n      alert('Error creating user');\n    }\n  };\n\n  return (\n    \u003Cform onSubmit={handleSubmit(onSubmit)}>\n      \u003Cdiv className=\"mb-4\">\n        \u003Clabel>Name\u003C\u002Flabel>\n        \u003Cinput {...register('name')} \u002F>\n        {errors.name && \u003Cspan className=\"error\">{errors.name.message}\u003C\u002Fspan>}\n      \u003C\u002Fdiv>\n\n      \u003Cdiv className=\"mb-4\">\n        \u003Clabel>Email\u003C\u002Flabel>\n        \u003Cinput type=\"email\" {...register('email')} \u002F>\n        {errors.email && \u003Cspan className=\"error\">{errors.email.message}\u003C\u002Fspan>}\n      \u003C\u002Fdiv>\n\n      \u003Cdiv className=\"mb-4\">\n        \u003Clabel>Age\u003C\u002Flabel>\n        \u003Cinput type=\"number\" {...register('age', { valueAsNumber: true })} \u002F>\n        {errors.age && \u003Cspan className=\"error\">{errors.age.message}\u003C\u002Fspan>}\n      \u003C\u002Fdiv>\n\n      \u003Cbutton type=\"submit\" disabled={isSubmitting}>\n        {isSubmitting ? 'Creating...' : 'Create User'}\n      \u003C\u002Fbutton>\n    \u003C\u002Fform>\n  );\n}\n```\n\n### Form Components\n\n```typescript\ninterface FormFieldProps {\n  label: string;\n  error?: string;\n  children: React.ReactNode;\n}\n\nfunction FormField({ label, error, children }: FormFieldProps) {\n  return (\n    \u003Cdiv className=\"mb-4\">\n      \u003Clabel className=\"block text-sm font-medium mb-1\">{label}\u003C\u002Flabel>\n      {children}\n      {error && \u003Cp className=\"text-red-500 text-sm mt-1\">{error}\u003C\u002Fp>}\n    \u003C\u002Fdiv>\n  );\n}\n\n\u002F\u002F Usage\n\u003CFormField label=\"Email\" error={errors.email?.message}>\n  \u003Cinput\n    type=\"email\"\n    {...register('email')}\n    className=\"w-full px-3 py-2 border rounded\"\n  \u002F>\n\u003C\u002FFormField>\n```\n\n---\n\n## Part 5: Tailwind CSS Integration\n\n### Utility Classes for React Components\n\n```typescript\n\u002F\u002F Button component with variants\nconst buttonVariants = {\n  primary: 'bg-blue-600 hover:bg-blue-700 focus:ring-blue-500',\n  secondary: 'bg-gray-200 hover:bg-gray-300 focus:ring-gray-500',\n  danger: 'bg-red-600 hover:bg-red-700 focus:ring-red-500',\n  ghost: 'bg-transparent hover:bg-gray-100 focus:ring-gray-500',\n};\n\nconst buttonSizes = {\n  sm: 'px-3 py-1.5 text-sm',\n  md: 'px-4 py-2 text-base',\n  lg: 'px-5 py-2.5 text-lg',\n};\n\nexport function Button({\n  variant = 'primary',\n  size = 'md',\n  className = '',\n  children,\n  ...props\n}: ButtonProps) {\n  return (\n    \u003Cbutton\n      className={cn(\n        'rounded-lg font-medium transition-colors focus:outline-none focus:ring-2',\n        buttonVariants[variant],\n        buttonSizes[size],\n        className\n      )}\n      {...props}\n    >\n      {children}\n    \u003C\u002Fbutton>\n  );\n}\n```\n\n### Responsive Variants\n\n```typescript\ninterface CardProps {\n  isFeatured?: boolean;\n  children: React.ReactNode;\n}\n\nexport function Card({ isFeatured = false, children }: CardProps) {\n  return (\n    \u003Cdiv\n      className={cn(\n        'rounded-lg shadow-md p-6 transition-all',\n        'bg-white hover:shadow-lg',\n        \u002F\u002F Responsive padding\n        'sm:p-4 md:p-6 lg:p-8',\n        \u002F\u002F Featured highlight\n        isFeatured && 'ring-2 ring-blue-500 border-2 border-blue-500'\n      )}\n    >\n      {children}\n    \u003C\u002Fdiv>\n  );\n}\n```\n\n---\n\n## Part 6: State Management Patterns\n\n### Context API for Global State\n\n```typescript\n\u002F\u002F AppContext.tsx\ninterface AppState {\n  user: User | null;\n  loading: boolean;\n  login: (credentials: LoginCredentials) => Promise\u003Cvoid>;\n  logout: () => void;\n}\n\nconst AppContext = createContext\u003CAppState | null>(null);\n\nexport function AppProvider({ children }: { children: React.ReactNode }) {\n  const [user, setUser] = useState\u003CUser | null>(null);\n  const [loading, setLoading] = useState(false);\n\n  const login = async (credentials: LoginCredentials) => {\n    setLoading(true);\n    try {\n      const userData = await api.login(credentials);\n      setUser(userData);\n    } finally {\n      setLoading(false);\n    }\n  };\n\n  const logout = () => {\n    api.logout();\n    setUser(null);\n  };\n\n  return (\n    \u003CAppContext.Provider value={{ user, loading, login, logout }}>\n      {children}\n    \u003C\u002FAppContext.Provider>\n  );\n}\n\nexport function useApp() {\n  const context = useContext(AppContext);\n  if (!context) throw new Error('useApp must be used within AppProvider');\n  return context;\n}\n```\n\n### Using React Query (TanStack Query)\n\n```typescript\nimport { useQuery, useMutation, useQueryClient } from '@tanstack\u002Freact-query';\n\n\u002F\u002F Fetch data\nfunction UserProfile({ userId }: { userId: string }) {\n  const { data: user, isLoading, error } = useQuery({\n    queryKey: ['user', userId],\n    queryFn: () => api.getUser(userId),\n    staleTime: 5 * 60 * 1000, \u002F\u002F 5 minutes\n  });\n\n  if (isLoading) return \u003CLoadingSpinner \u002F>;\n  if (error) return \u003CErrorAlert message={error.message} \u002F>;\n\n  return (\n    \u003Cdiv>\n      \u003Ch1>{user?.name}\u003C\u002Fh1>\n      \u003Cp>{user?.email}\u003C\u002Fp>\n    \u003C\u002Fdiv>\n  );\n}\n\n\u002F\u002F Mutate data\nfunction UpdateUserForm({ user: initialUser }: { user: User }) {\n  const queryClient = useQueryClient();\n  const mutation = useMutation({\n    mutationFn: api.updateUser,\n    onSuccess: () => {\n      \u002F\u002F Invalidate and refetch\n      queryClient.invalidateQueries({ queryKey: ['user', initialUser.id] });\n    },\n  });\n\n  const handleSubmit = (data: Partial\u003CUser>) => {\n    mutation.mutate({ ...initialUser, ...data });\n  };\n\n  return (\n    \u003Cform onSubmit={(e) => { e.preventDefault(); handleSubmit(\u002F* data *\u002F); }}>\n      {\u002F* Form fields *\u002F}\n    \u003C\u002Fform>\n  );\n}\n```\n\n---\n\n## Part 7: Performance Optimization\n\n### Code Splitting with React.lazy\n\n```typescript\nimport { lazy, Suspense } from 'react';\n\n\u002F\u002F Lazy load components\nconst Dashboard = lazy(() => import('.\u002Fpages\u002FDashboard'));\nconst Reports = lazy(() => import('.\u002Fpages\u002FReports'));\nconst Settings = lazy(() => import('.\u002Fpages\u002FSettings'));\n\nfunction App() {\n  return (\n    \u003CSuspense fallback={\u003CLoadingSpinner \u002F>}>\n      \u003CRoutes>\n        \u003CRoute path=\"\u002Fdashboard\" element={\u003CDashboard \u002F>} \u002F>\n        \u003CRoute path=\"\u002Freports\" element={\u003CReports \u002F>} \u002F>\n        \u003CRoute path=\"\u002Fsettings\" element={\u003CSettings \u002F>} \u002F>\n      \u003C\u002FRoutes>\n    \u003C\u002FSuspense>\n  );\n}\n```\n\n### Virtual Scrolling\n\n```typescript\nimport { useVirtualizer } from '@tanstack\u002Freact-virtual';\n\nfunction VirtualList({ items }: { items: Item[] }) {\n  const parentRef = useRef\u003CHTMLDivElement>(null);\n\n  const virtualizer = useVirtualizer({\n    count: items.length,\n    getScrollElement: () => parentRef.current,\n    estimateSize: () => 50, \u002F\u002F Estimated item height\n    overscan: 5, \u002F\u002F Render extra items beyond viewport\n  });\n\n  return (\n    \u003Cdiv ref={parentRef} className=\"h-96 overflow-auto\">\n      \u003Cdiv\n        style={{\n          height: `${virtualizer.getTotalSize()}px`,\n          position: 'relative',\n        }}\n      >\n        {virtualizer.getVirtualItems().map((virtualItem) => {\n          const item = items[virtualItem.index];\n          return (\n            \u003Cdiv\n              key={virtualItem.key}\n              style={{\n                position: 'absolute',\n                top: 0,\n                left: 0,\n                width: '100%',\n                height: `${virtualItem.size}px`,\n                transform: `translateY(${virtualItem.start}px)`,\n              }}\n            >\n              {\u002F*\n...existing code...\n*\u002F}\n            \u003C\u002Fdiv>\n          );\n        })}\n      \u003C\u002Fdiv>\n    \u003C\u002Fdiv>\n  );\n}\n```\n\n---\n\n## Part 8: Testing with React Testing Library\n\n```typescript\nimport { render, screen, fireEvent, waitFor } from '@testing-library\u002Freact';\nimport { expect } from 'vitest';\nimport userEvent from '@testing-library\u002Fuser-event';\n\ndescribe('Button Component', () => {\n  it('renders children correctly', () => {\n    render(\u003CButton>Click Me\u003C\u002FButton>);\n    expect(screen.getByText('Click Me')).toBeInTheDocument();\n  });\n\n  it('calls onClick handler when clicked', async () => {\n    const user = userEvent.setup();\n    const handleClick = vi.fn();\n\n    render(\u003CButton onClick={handleClick}>Click Me\u003C\u002FButton>);\n\n    await user.click(screen.getByText('Click Me'));\n    expect(handleClick).toHaveBeenCalledTimes(1);\n  });\n\n  it('is disabled when disabled prop is true', () => {\n    render(\u003CButton disabled>Cannot Click\u003C\u002FButton>);\n    expect(screen.getByRole('button')).toBeDisabled();\n  });\n});\n\ndescribe('UseFetch Hook', () => {\n  it('fetches data and returns it', async () => {\n    const { result } = renderHook(() => useFetch('\u002Fapi\u002Ftest'));\n\n    await waitFor(() => {\n      expect(result.current.data).toBeDefined();\n      expect(result.current.loading).toBe(false);\n    });\n  });\n});\n```\n\n---\n\n## Modern Component and Testing Examples\n\n### Server Components\n```tsx\nexport async function OrdersPanel() {\n  const orders = await getOrders();\n  return \u003COrdersTable orders={orders} \u002F>;\n}\n```\n\n### Error Boundaries\n```tsx\nimport { ErrorBoundary } from 'react-error-boundary';\n\n\u003CErrorBoundary fallbackRender={() => \u003Cp>Could not load dashboard.\u003C\u002Fp>}>\n  \u003CDashboard \u002F>\n\u003C\u002FErrorBoundary>\n```\n\n### Accessibility Testing Tools\n```tsx\nimport { axe } from 'jest-axe';\n\ntest('dialog passes axe checks', async () => {\n  const { container } = render(\u003CAccountDialog open \u002F>);\n  expect(await axe(container)).toHaveNoViolations();\n});\n```\n\n## React Development Best Practices\n\n### Components\n- [ ] Use functional components with hooks\n- [ ] Keep components small and focused\n- [ ] Use TypeScript for type safety\n- [ ] Implement proper error boundaries\n- [ ] Add loading and error states\n\n### Hooks\n- [ ] Follow rules of hooks (only call at top level)\n- [ ] Use custom hooks for reusable stateful logic\n- [ ] Memoize expensive computations and callbacks\n- [ ] Clean up side effects properly\n\n### Performance\n- [ ] Implement code splitting for large bundles\n- [ ] Use virtual scrolling for long lists\n- [ ] Debounce\u002Fthrottle user input\n- [ ] Lazy load images and resources\n\n### Accessibility\n- [ ] Use semantic HTML elements\n- [ ] Ensure keyboard navigation works\n- [ ] Add ARIA labels where needed\n- [ ] Support screen readers properly\n- [ ] Test with accessibility tools\n\n---\n\n## Common Pitfalls\n\n- Fetching everything in client effects by default: Server-first data loading is usually simpler, faster, and easier to cache.\n- Overusing memoization without a profiler: Manual memoization adds complexity and can hide stale-prop bugs.\n- Skipping accessible names and keyboard flows: Components can appear done while still failing real user interaction paths.\n\n## References & Resources\n\n### Documentation\n- [Hooks Reference](.\u002Freferences\u002Fhooks-reference.md) — All 17 React hooks including React 19 new hooks (use, useFormStatus, useOptimistic)\n- [Patterns Catalog](.\u002Freferences\u002Fpatterns-catalog.md) — 12 React component patterns with TypeScript examples\n\n### Scripts\n- [Component Generator](.\u002Fscripts\u002Fcomponent-generator.ps1) — PowerShell component scaffolder with types: functional, page, layout, context\n\n### Examples\n- [Custom Hooks Gallery](.\u002Fexamples\u002Fcustom-hooks-gallery.md) — 12 production-ready custom hooks with full implementations and tests\n\n---\n\n## Related Skills\n\n- [javascript-development](..\u002Fjavascript-development\u002FSKILL.md): Use it when the workflow also needs modern JavaScript and TypeScript application code.\n- [nextjs-development](..\u002Fnextjs-development\u002FSKILL.md): Use it when the workflow also needs Next.js App Router and server-first React patterns.\n- [web-testing](..\u002Fweb-testing\u002FSKILL.md): Use it when the workflow also needs browser and end-to-end testing evidence.\n- [code-quality](..\u002Fcode-quality\u002FSKILL.md): Use it when the workflow also needs two-stage review (spec compliance first, then code quality), maintainability, and refactoring guidance.\n","# React Development\n\n> Optimized for React 19+, TypeScript 5.5+, React Testing Library 16+, and modern server-first app architectures.\n\nExpert guidance for building high-quality React applications with React 19+, modern hooks, TypeScript, and best practices following official React documentation at https:\u002F\u002Freact.dev.\n\n- Leverage native parallel subagent dispatch and 200k+ context windows where available.\n\n\n## Component Review Rubric Reference\n\nApply the shared [Component Review Rubric](..\u002Ffrontend-design\u002FSKILL.md#component-review-rubric) before approving React components, then run the React-specific checks below.\n\n\u003C!-- MCP:START -->\n\n\u003C!-- PORTABILITY:START -->\n## Cross-Client Portability\n\nThis skill is written to stay usable across GitHub Copilot, Claude Code, and Codex.\n\n- GitHub Copilot: keep the folder in a Copilot-visible skill path or wrap the\n  workflow in project instructions when folder discovery is unavailable.\n- Claude Code: keep the folder in a local skills directory or a compatible plugin source.\n- Codex: install or sync the folder into\n  `$CODEX_HOME\u002Fskills\u002Freact-development` and restart Codex after major changes.\n\n\u003C!-- PORTABILITY:END -->\n\n## MCP Availability And Fallback\n\nPreferred MCP Server: None required\n\n- Fallback prompt: \"Use the React Development skill without MCP. Rely on its local instructions, bundled resources, standard shell or editor tools, and direct verification. Show the evidence used before concluding.\"\n- Do not claim an MCP operation was used when the active host does not expose it.\n- Treat local files, tests, rendered outputs, logs, or screenshots as the fallback evidence path.\n\n\u003C!-- MCP:END -->\n\n## Anti-Patterns\n\n- Fetching everything in client effects by default: Server-first data loading is usually simpler, faster, and easier to cache.\n- Adding memoization before profiling: Manual optimizations can create stale-prop bugs and hide simpler design fixes.\n- Skipping keyboard and accessible-name review: A component is not done if only pointer users can operate it reliably.\n\n## Verification Protocol\n\nBefore claiming \"skill applied successfully\":\n\n1. Pass\u002Ffail: The React Development guidance is tied to a concrete route, component, screen, or design artifact.\n2. Pass\u002Ffail: Component states cover loading, empty, error, success, and responsive breakpoints where applicable.\n3. Pass\u002Ffail: Accessibility, visual hierarchy, and interaction behavior are reviewed against the shared component rubric.\n4. Pressure-test scenario: Review the component on a narrow mobile viewport, keyboard-only path, and slow-loading state.\n5. Success metric: Zero generic UI approval; every approval cites rendered behavior or source evidence.\n\n## Before and After Example\n\n```tsx\n\u002F\u002F Before\n'use client';\n\nexport function Dashboard() {\n  const [orders, setOrders] = useState\u003COrder[]>([]);\n  useEffect(() => {\n    fetch('\u002Fapi\u002Forders').then((r) => r.json()).then(setOrders);\n  }, []);\n  return \u003COrdersTable orders={orders} \u002F>;\n}\n\n\u002F\u002F After\nexport async function Dashboard() {\n  const orders = await getOrders();\n  return \u003COrdersTable orders={orders} \u002F>;\n}\n```\n\nLets the server boundary load data directly and keeps the client side focused on interaction, not bootstrapping.\n\n## Activation Conditions\n\nUse symptom -> action triggers: when one matches, apply this skill and verify with the protocol below.\n\n**Core React Development:**\n- Building React components with hooks and TypeScript\n- Setting up React applications (Vite, Next.js, CRA)\n- Working with React Router for navigation\n- Implementing forms and user input handling\n- Creating responsive layouts and component architecture\n\n**State Management & Data:**\n- Managing state (useState, useReducer, useContext)\n- Implementing React Query or SWR for data fetching\n- Building custom hooks for reusable stateful logic\n- Creating Context providers for global state\n- Implementing React 19 Server Components (if using Next.js)\n\n**Component Patterns:**\n- Creating reusable UI components with proper composition\n- Building forms with React Hook Form and Zod validation\n- Implementing modal dialogs and overlays\n- Creating custom React hooks (useDebounce, useLocalStorage)\n- Designing responsive variants for different screen sizes\n\n**Performance & Quality:**\n- Optimizing React app performance\n- Implementing memoization (useMemo, useCallback)\n- Code splitting and lazy loading\n- Writing tests with React Testing Library\n- Ensuring accessibility compliance (ARIA, keyboard nav)\n\n## Part 1: React Fundamentals\n\n### Project Structure\n\n**Recommended Structure:**\n```\nsrc\u002F\n├── components\u002F          # Reusable UI components\n│   ├── ui\u002F            # Primitives (Button, Input, Modal)\n│   ├── forms\u002F          # Form components\n│   └── layout\u002F         # Layout components\n├── hooks\u002F              # Custom hooks\n├── contexts\u002F            # Context providers\n├── pages\u002F              # Page components\n├── lib\u002F                # Utilities, API clients\n├── types\u002F              # TypeScript types\n├── styles\u002F              # Global styles\n└── main.jsx            # App entry point\n```\n\n### Component Architecture\n\n#### Functional Components (React 19 Standard)\n\n```typescript\ninterface ButtonProps {\n  variant: 'primary' | 'secondary' | 'danger';\n  size?: 'sm' | 'md' | 'lg';\n  onClick: (event: React.MouseEvent\u003CHTMLButtonElement>) => void;\n  children: React.ReactNode;\n  disabled?: boolean;\n  isLoading?: boolean;\n}\n\nexport function Button({\n  variant = 'primary',\n  size = 'md',\n  onClick,\n  children,\n  disabled = false,\n  isLoading = false,\n}: ButtonProps) {\n  const baseClasses = 'rounded-lg font-medium transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2';\n\n  const variantClasses = {\n    primary: 'bg-blue-600 hover:bg-blue-700 text-white focus:ring-blue-500',\n    secondary: 'bg-gray-100 hover:bg-gray-200 text-gray-900 focus:ring-gray-500',\n    danger: 'bg-red-600 hover:bg-red-700 text-white focus:ring-red-500',\n  };\n\n  const sizeClasses = {\n    sm: 'px-3 py-1.5 text-sm',\n    md: 'px-4 py-2 text-base',\n    lg: 'px-5 py-2.5 text-lg',\n  };\n\n  return (\n    \u003Cbutton\n      disabled={disabled || isLoading}\n      onClick={onClick}\n      className={`${baseClasses} ${variantClasses[variant]} ${sizeClasses[size]}`}\n    >\n      {isLoading ? 'Loading...' : children}\n    \u003C\u002Fbutton>\n  );\n}\n```\n\n#### Generic Components\n\n```typescript\ninterface ListProps\u003CT> {\n  items: T[];\n  renderItem: (item: T, index: number) => React.ReactNode;\n  keyExtractor: (item: T) => string;\n  emptyMessage?: string;\n}\n\nfunction List\u003CT>({ items, renderItem, keyExtractor, emptyMessage = 'No items' }: ListProps\u003CT>) {\n  return (\n    \u003Cul>\n      {items.length === 0 ? (\n        \u003Cli>{emptyMessage}\u003C\u002Fli>\n      ) : (\n        items.map((item, index) => (\n          \u003Cli key={keyExtractor(item)}>\n            {renderItem(item, index)}\n          \u003C\u002Fli>\n        ))\n      )}\n    \u003C\u002Ful>\n  );\n}\n\n\u002F\u002F Usage\n\u003CList\n  items={users}\n  renderItem={(user) => `${user.firstName} ${user.lastName}`}\n  keyExtractor={(user) => user.id}\n\u002F>\n```\n\n### Component Patterns\n\n**Composition over Inheritance:**\n\n```typescript\n\u002F\u002F ✅ GOOD - Component composition\nfunction Card({ children }: { children: React.ReactNode }) {\n  return (\n    \u003Cdiv className=\"border rounded-lg p-4 shadow-sm\">\n      {children}\n    \u003C\u002Fdiv>\n  );\n}\n\nfunction CardHeader({ children }: { children: React.ReactNode }) {\n  return (\n    \u003Cdiv className=\"font-bold text-lg mb-2 border-b pb-2\">\n      {children}\n    \u003C\u002Fdiv>\n  );\n}\n\nfunction CardBody({ children }: { children: React.ReactNode }) {\n  return \u003Cdiv>{children}\u003C\u002Fdiv>;\n}\n\n\u002F\u002F Usage\n\u003CCard>\n  \u003CCardHeader>Title\u003C\u002FCardHeader>\n  \u003CCardBody>Content here\u003C\u002FCardBody>\n\u003C\u002FCard>\n\n\u002F\u002F ❌ BAD - Inheritance or complex props\nfunction Card({ renderHeader, renderBody, renderFooter }: { ... }) { ... }\n```\n\n**Presentational vs Container Components:**\n\n```typescript\n\u002F\u002F Presentational - UI only, doesn't fetch data\ninterface UserCardProps {\n  user: User;\n  onStatusChange: (status: string) => void;\n}\n\nfunction UserCard({ user, onStatusChange }: UserCardProps) {\n  return (\n    \u003Cdiv>\n      \u003Ch3>{user.name}\u003C\u002Fh3>\n      \u003Cselect value={user.status} onChange={(e) => onStatusChange(e.target.value)}>\n        \u003Coption value=\"active\">Active\u003C\u002Foption>\n        \u003Coption value=\"inactive\">Inactive\u003C\u002Foption>\n      \u003C\u002Fselect>\n    \u003C\u002Fdiv>\n  );\n}\n\n\u002F\u002F Container - Fetches data, passes to presentational\nfunction UserContainer() {\n  const { data: user, mutate: updateStatus } = useUser(userId);\n\n  return user ? (\n    \u003CUserCard user={user} onStatusChange={(status) => updateStatus({ status })} \u002F>\n  ) : (\n    \u003CLoadingSpinner \u002F>\n  );\n}\n```\n\n---\n\n## Part 2: Hooks Patterns\n\n### Built-in Hooks Mastery\n\n#### useState - For Local State\n\n```typescript\n\u002F\u002F Simple state\nfunction Counter() {\n  const [count, setCount] = useState(0);\n\n  return (\n    \u003Cdiv>\n      \u003Cspan>{count}\u003C\u002Fspan>\n      \u003Cbutton onClick={() => setCount(c => c + 1)}>Increment\u003C\u002Fbutton>\n    \u003C\u002Fdiv>\n  );\n}\n\n\u002F\u002F Complex state - use useReducer instead\nfunction Form() {\n  type FormState = {\n    name: string;\n    email: string;\n    submitted: boolean;\n  };\n\n  const [form, setForm] = useState\u003CFormState>({\n    name: '',\n    email: '',\n    submitted: false,\n  });\n\n  const updateField = (field: keyof FormState) => (\n    e: React.ChangeEvent\u003CHTMLInputElement>\n  ) => setForm(f => ({ ...f, [field]: e.target.value }));\n\n  return (\n    \u003Cform>\n      \u003Cinput value={form.name} onChange={updateField('name')} \u002F>\n      \u003Cinput value={form.email} onChange={updateField('email')} \u002F>\n    \u003C\u002Fform>\n  );\n}\n```\n\n#### useReducer - For Complex State\n\n```typescript\ntype Action =\n  | { type: 'ADD_TODO'; payload: string }\n  | { type: 'TOGGLE_TODO'; payload: number }\n  | { type: 'DELETE_TODO'; payload: number };\n\ntype TodoState = {\n  items: Array\u003C{ id: number; text: string; completed: boolean }>;\n};\n\nfunction todosReducer(state: TodoState, action: Action): TodoState {\n  switch (action.type) {\n    case 'ADD_TODO':\n      return {\n        items: [\n          ...state.items,\n          { id: Date.now(), text: action.payload, completed: false },\n        ],\n      };\n    case 'TOGGLE_TODO':\n      return {\n        items: state.items.map((item) =>\n          item.id === action.payload ? { ...item, completed: !item.completed } : item\n        ),\n      };\n    case 'DELETE_TODO':\n      return {\n        items: state.items.filter((item) => item.id !== action.payload),\n      };\n    default:\n      return state;\n  }\n}\n\nfunction TodoApp() {\n  const [state, dispatch] = useReducer(todosReducer, { items: [] });\n\n  return (\n    \u003Cdiv>\n      \u003CToDoList items={state.items} onToggle={(id) => dispatch({ type: 'TOGGLE_TODO', payload: id })} \u002F>\n    \u003C\u002Fdiv>\n  );\n}\n```\n\n#### useEffect - For Side Effects\n\n```typescript\nfunction UserProfile({ userId }: { userId: string }) {\n  const [user, setUser] = useState\u003CUser | null>(null);\n\n  \u002F\u002F ✅ GOOD - Run on mount and when userId changes\n  useEffect(() => {\n    let cancelled = false;\n\n    async function fetchUser() {\n      const userData = await api.getUser(userId);\n      if (!cancelled) {\n        setUser(userData);\n      }\n    }\n\n    fetchUser();\n\n    return () => {\n      cancelled = true; \u002F\u002F Cleanup to prevent state updates after unmount\n    };\n  }, [userId]);\n\n  \u002F\u002F ✅ GOOD - Document title update\n  useEffect(() => {\n    if (user) {\n      document.title = `${user.name} - Profile`;\n    }\n    return () => {\n      document.title = 'App';\n    };\n  }, [user]);\n\n  if (!user) return \u003CLoadingSkeleton \u002F>;\n\n  return (\n    \u003Cdiv>\n      \u003Ch1>{user.name}\u003C\u002Fh1>\n      {\u002F* ... *\u002F}\n    \u003C\u002Fdiv>\n  );\n}\n```\n\n#### useContext - For Global State\n\n```typescript\n\u002F\u002F Context creation\ntype ThemeContextType = {\n  theme: 'light' | 'dark';\n  toggleTheme: () => void;\n};\n\nconst ThemeContext = createContext\u003CThemeContextType | null>(null);\n\n\u002F\u002F Provider component\nexport function ThemeProvider({ children }: { children: React.ReactNode }) {\n  const [theme, setTheme] = useState\u003C'light' | 'dark'>('light');\n\n  const toggleTheme = () => setTheme(t => t === 'light' ? 'dark' : 'light');\n\n  return (\n    \u003CThemeContext.Provider value={{ theme, toggleTheme }}>\n      {children}\n    \u003C\u002FThemeContext.Provider>\n  );\n}\n\n\u002F\u002F Custom hook for using context\nexport function useTheme() {\n  const context = useContext(ThemeContext);\n  if (!context) {\n    throw new Error('useTheme must be used within ThemeProvider');\n  }\n  return context;\n}\n\n\u002F\u002F Usage in component\nfunction ThemedButton() {\n  const { theme, toggleTheme } = useTheme();\n\n  return (\n    \u003Cbutton\n      onClick={toggleTheme}\n      className={theme === 'dark' ? 'bg-gray-800 text-white' : 'bg-white text-black'}\n    >\n      Toggle {theme} theme\n    \u003C\u002Fbutton>\n  );\n}\n```\n\n### Performance Hooks\n\n#### useMemo - Memoize Expensive Computations\n\n```typescript\nfunction ProductList({ products }: { products: Product[] }) {\n  \u002F\u002F ✅ GOOD - Memoize expensive calculation\n  const sortedProducts = useMemo(() => {\n    return [...products].sort((a, b) => a.price - b.price);\n  }, [products]);\n\n  const expensiveAnalysis = useMemo(() => {\n    \u002F\u002F Only recompute when prices change\n    const avgPrice = products.reduce((sum, p) => sum + p.price, 0) \u002F products.length;\n    const maxPrice = Math.max(...products.map(p => p.price));\n    return { avgPrice, maxPrice };\n  }, [products]);\n\n  return (\n    \u003Cdiv>\n      \u003CStatsCard data={expensiveAnalysis} \u002F>\n      \u003CProductCards products={sortedProducts} \u002F>\n    \u003C\u002Fdiv>\n  );\n}\n```\n\n#### useCallback - Memoize Functions\n\n```typescript\nfunction ParentComponent() {\n  const [items, setItems] = useState\u003CItem[]>([]);\n\n  \u002F\u002F ✅ GOOD - Memoize callback to prevent child re-renders\n  const handleItemAdd = useCallback((item: Item) => {\n    setItems(prev => [...prev, item]);\n  }, []);\n\n  const handleItemRemove = useCallback((id: string) => {\n    setItems(prev => prev.filter(item => item.id !== id));\n  }, []);\n\n  return (\n    \u003Cdiv>\n      \u003CAddItemForm onAdd={handleItemAdd} \u002F>\n      \u003CItemList items={items} onRemove={handleItemRemove} \u002F>\n    \u003C\u002Fdiv>\n  );\n}\n\n\u002F\u002F Child component wrapped in React.memo\nconst ItemList = React.memo(function ItemList({\n  items,\n  onRemove,\n}: {\n  items: Item[];\n  onRemove: (id: string) => void;\n}) {\n  return (\n    \u003Cul>\n      {items.map(item => (\n        \u003Cli key={item.id}>\n          {item.name}\n          \u003Cbutton onClick={() => onRemove(item.id)}>Remove\u003C\u002Fbutton>\n        \u003C\u002Fli>\n      ))}\n    \u003C\u002Ful>\n  );\n});\n```\n\n---\n\n## Part 3: Custom Hooks\n\n### useDebounce\n\nDebounce rapid value changes, useful for search inputs:\n\n```typescript\nimport { useState, useEffect } from 'react';\n\nfunction useDebounce\u003CT>(value: T, delay: number = 500): T {\n  const [debouncedValue, setDebouncedValue] = useState\u003CT>(value);\n\n  useEffect(() => {\n    const handler = setTimeout(() => {\n      setDebouncedValue(value);\n    }, delay);\n\n    return () => {\n      clearTimeout(handler);\n    };\n  }, [value, delay]);\n\n  return debouncedValue;\n}\n\n\u002F\u002F Usage\nfunction SearchBar() {\n  const [query, setQuery] = useState('');\n  const debouncedQuery = useDebounce(query, 300);\n\n  useEffect(() => {\n    \u002F\u002F This only runs 300ms after user stops typing\n    if (debouncedQuery) {\n      performSearch(debouncedQuery);\n    }\n  }, [debouncedQuery]);\n\n  return (\n    \u003Cinput\n      type=\"text\"\n      value={query}\n      onChange={(e) => setQuery(e.target.value)}\n      placeholder=\"Search...\"\n    \u002F>\n  );\n}\n```\n\n### useLocalStorage\n\nPersist state to localStorage:\n\n```typescript\nfunction useLocalStorage\u003CT>(key: string, initialValue: T) {\n  const [storedValue, setStoredValue] = useState\u003CT>(() => {\n    try {\n      const item = window.localStorage.getItem(key);\n      return item ? JSON.parse(item) : initialValue;\n    } catch (error) {\n      console.error(`Error reading localStorage key \"${key}\":`, error);\n      return initialValue;\n    }\n  });\n\n  const setValue = (value: T | ((val: T) => T)) => {\n    try {\n      const valueToStore = value instanceof Function ? value(storedValue) : value;\n      setStoredValue(valueToStore);\n      window.localStorage.setItem(key, JSON.stringify(valueToStore));\n    } catch (error) {\n      console.error(`Error setting localStorage key \"${key}\":`, error);\n    }\n  };\n\n  return [storedValue, setValue] as const;\n}\n\n\u002F\u002F Usage\nfunction ThemeToggle() {\n  const [theme, setTheme] = useLocalStorage\u003C'light' | 'dark'>('theme', 'light');\n\n  return (\n    \u003Cbutton onClick={() => setTheme(theme === 'light' ? 'dark' : 'light')}>\n      Current theme: {theme}\n    \u003C\u002Fbutton>\n  );\n}\n```\n\n### useToggle\n\nToggle boolean state with useful utilities:\n\n```typescript\nfunction useToggle(initialValue: boolean = false) {\n  const [value, setValue] = useState(initialValue);\n\n  const toggle = useCallback(() => setValue(v => !v), []);\n  const setTrue = useCallback(() => setValue(true), []);\n  const setFalse = useCallback(() => setValue(false), []);\n\n  return { value, toggle, setTrue, setFalse, setValue } as const;\n}\n\n\u002F\u002F Usage\nfunction ModalExample() {\n  const { value: isOpen, toggle, setFalse: close } = useToggle(false);\n\n  return (\n    \u003C>\n      \u003Cbutton onClick={toggle}>Open Modal\u003C\u002Fbutton>\n      \u003CModal isOpen={isOpen} onClose={close}>\n        \u003Cp>Modal content\u003C\u002Fp>\n      \u003C\u002FModal>\n    \u003C\u002F>\n  );\n}\n```\n\n### useFetch\n\nData fetching with loading and error states:\n\n```typescript\ntype UseFetchResult\u003CT> = {\n  data: T | null;\n  loading: boolean;\n  error: Error | null;\n  refetch: () => Promise\u003Cvoid>;\n};\n\nfunction useFetch\u003CT>(url: string): UseFetchResult\u003CT> {\n  const [data, setData] = useState\u003CT | null>(null);\n  const [loading, setLoading] = useState(true);\n  const [error, setError] = useState\u003CError | null>(null);\n\n  const fetchData = useCallback(async () => {\n    setLoading(true);\n    setError(null);\n\n    try {\n      const response = await fetch(url);\n      const jsonData = await response.json();\n      setData(jsonData);\n    } catch (err) {\n      setError(err as Error);\n    } finally {\n      setLoading(false);\n    }\n  }, [url]);\n\n  useEffect(() => {\n    fetchData();\n  }, [fetchData]);\n\n  return { data, loading, error, refetch: fetchData };\n}\n\n\u002F\u002F Usage\nfunction UserProfile({ userId }: { userId: string }) {\n  const { data: user, loading, error } = useFetch\u003CUser>(`\u002Fapi\u002Fusers\u002F${userId}`);\n\n  if (loading) return \u003CLoadingSpinner \u002F>;\n  if (error) return \u003CErrorAlert message={error.message} \u002F>;\n\n  return (\n    \u003Cdiv>\n      \u003Ch1>{user?.name}\u003C\u002Fh1>\n      \u003Cp>{user?.email}\u003C\u002Fp>\n    \u003C\u002Fdiv>\n  );\n}\n```\n\n---\n\n## Part 4: Forms & Validation\n\n### React Hook Form with Zod\n\n```typescript\nimport { useForm } from 'react-hook-form';\nimport { zodResolver } from '@hookform\u002Fresolvers\u002Fzod';\nimport { z } from 'zod';\n\n\u002F\u002F Zod schema for validation\nconst formSchema = z.object({\n  name: z.string().min(2, 'Name must be at least 2 characters'),\n  email: z.string().email('Invalid email address'),\n  age: z.number().min(18, 'Must be at least 18'),\n  subscribe: z.boolean().default(false),\n});\n\ntype FormData = z.infer\u003Ctypeof formSchema>;\n\nfunction UserForm() {\n  const {\n    register,\n    handleSubmit,\n    formState: { errors, isSubmitting },\n  } = useForm\u003CFormData>({\n    resolver: zodResolver(formSchema),\n  });\n\n  const onSubmit = async (data: FormData) => {\n    try {\n      await api.createUser(data);\n      alert('User created successfully!');\n    } catch (error) {\n      alert('Error creating user');\n    }\n  };\n\n  return (\n    \u003Cform onSubmit={handleSubmit(onSubmit)}>\n      \u003Cdiv className=\"mb-4\">\n        \u003Clabel>Name\u003C\u002Flabel>\n        \u003Cinput {...register('name')} \u002F>\n        {errors.name && \u003Cspan className=\"error\">{errors.name.message}\u003C\u002Fspan>}\n      \u003C\u002Fdiv>\n\n      \u003Cdiv className=\"mb-4\">\n        \u003Clabel>Email\u003C\u002Flabel>\n        \u003Cinput type=\"email\" {...register('email')} \u002F>\n        {errors.email && \u003Cspan className=\"error\">{errors.email.message}\u003C\u002Fspan>}\n      \u003C\u002Fdiv>\n\n      \u003Cdiv className=\"mb-4\">\n        \u003Clabel>Age\u003C\u002Flabel>\n        \u003Cinput type=\"number\" {...register('age', { valueAsNumber: true })} \u002F>\n        {errors.age && \u003Cspan className=\"error\">{errors.age.message}\u003C\u002Fspan>}\n      \u003C\u002Fdiv>\n\n      \u003Cbutton type=\"submit\" disabled={isSubmitting}>\n        {isSubmitting ? 'Creating...' : 'Create User'}\n      \u003C\u002Fbutton>\n    \u003C\u002Fform>\n  );\n}\n```\n\n### Form Components\n\n```typescript\ninterface FormFieldProps {\n  label: string;\n  error?: string;\n  children: React.ReactNode;\n}\n\nfunction FormField({ label, error, children }: FormFieldProps) {\n  return (\n    \u003Cdiv className=\"mb-4\">\n      \u003Clabel className=\"block text-sm font-medium mb-1\">{label}\u003C\u002Flabel>\n      {children}\n      {error && \u003Cp className=\"text-red-500 text-sm mt-1\">{error}\u003C\u002Fp>}\n    \u003C\u002Fdiv>\n  );\n}\n\n\u002F\u002F Usage\n\u003CFormField label=\"Email\" error={errors.email?.message}>\n  \u003Cinput\n    type=\"email\"\n    {...register('email')}\n    className=\"w-full px-3 py-2 border rounded\"\n  \u002F>\n\u003C\u002FFormField>\n```\n\n---\n\n## Part 5: Tailwind CSS Integration\n\n### Utility Classes for React Components\n\n```typescript\n\u002F\u002F Button component with variants\nconst buttonVariants = {\n  primary: 'bg-blue-600 hover:bg-blue-700 focus:ring-blue-500',\n  secondary: 'bg-gray-200 hover:bg-gray-300 focus:ring-gray-500',\n  danger: 'bg-red-600 hover:bg-red-700 focus:ring-red-500',\n  ghost: 'bg-transparent hover:bg-gray-100 focus:ring-gray-500',\n};\n\nconst buttonSizes = {\n  sm: 'px-3 py-1.5 text-sm',\n  md: 'px-4 py-2 text-base',\n  lg: 'px-5 py-2.5 text-lg',\n};\n\nexport function Button({\n  variant = 'primary',\n  size = 'md',\n  className = '',\n  children,\n  ...props\n}: ButtonProps) {\n  return (\n    \u003Cbutton\n      className={cn(\n        'rounded-lg font-medium transition-colors focus:outline-none focus:ring-2',\n        buttonVariants[variant],\n        buttonSizes[size],\n        className\n      )}\n      {...props}\n    >\n      {children}\n    \u003C\u002Fbutton>\n  );\n}\n```\n\n### Responsive Variants\n\n```typescript\ninterface CardProps {\n  isFeatured?: boolean;\n  children: React.ReactNode;\n}\n\nexport function Card({ isFeatured = false, children }: CardProps) {\n  return (\n    \u003Cdiv\n      className={cn(\n        'rounded-lg shadow-md p-6 transition-all',\n        'bg-white hover:shadow-lg',\n        \u002F\u002F Responsive padding\n        'sm:p-4 md:p-6 lg:p-8',\n        \u002F\u002F Featured highlight\n        isFeatured && 'ring-2 ring-blue-500 border-2 border-blue-500'\n      )}\n    >\n      {children}\n    \u003C\u002Fdiv>\n  );\n}\n```\n\n---\n\n## Part 6: State Management Patterns\n\n### Context API for Global State\n\n```typescript\n\u002F\u002F AppContext.tsx\ninterface AppState {\n  user: User | null;\n  loading: boolean;\n  login: (credentials: LoginCredentials) => Promise\u003Cvoid>;\n  logout: () => void;\n}\n\nconst AppContext = createContext\u003CAppState | null>(null);\n\nexport function AppProvider({ children }: { children: React.ReactNode }) {\n  const [user, setUser] = useState\u003CUser | null>(null);\n  const [loading, setLoading] = useState(false);\n\n  const login = async (credentials: LoginCredentials) => {\n    setLoading(true);\n    try {\n      const userData = await api.login(credentials);\n      setUser(userData);\n    } finally {\n      setLoading(false);\n    }\n  };\n\n  const logout = () => {\n    api.logout();\n    setUser(null);\n  };\n\n  return (\n    \u003CAppContext.Provider value={{ user, loading, login, logout }}>\n      {children}\n    \u003C\u002FAppContext.Provider>\n  );\n}\n\nexport function useApp() {\n  const context = useContext(AppContext);\n  if (!context) throw new Error('useApp must be used within AppProvider');\n  return context;\n}\n```\n\n### Using React Query (TanStack Query)\n\n```typescript\nimport { useQuery, useMutation, useQueryClient } from '@tanstack\u002Freact-query';\n\n\u002F\u002F Fetch data\nfunction UserProfile({ userId }: { userId: string }) {\n  const { data: user, isLoading, error } = useQuery({\n    queryKey: ['user', userId],\n    queryFn: () => api.getUser(userId),\n    staleTime: 5 * 60 * 1000, \u002F\u002F 5 minutes\n  });\n\n  if (isLoading) return \u003CLoadingSpinner \u002F>;\n  if (error) return \u003CErrorAlert message={error.message} \u002F>;\n\n  return (\n    \u003Cdiv>\n      \u003Ch1>{user?.name}\u003C\u002Fh1>\n      \u003Cp>{user?.email}\u003C\u002Fp>\n    \u003C\u002Fdiv>\n  );\n}\n\n\u002F\u002F Mutate data\nfunction UpdateUserForm({ user: initialUser }: { user: User }) {\n  const queryClient = useQueryClient();\n  const mutation = useMutation({\n    mutationFn: api.updateUser,\n    onSuccess: () => {\n      \u002F\u002F Invalidate and refetch\n      queryClient.invalidateQueries({ queryKey: ['user', initialUser.id] });\n    },\n  });\n\n  const handleSubmit = (data: Partial\u003CUser>) => {\n    mutation.mutate({ ...initialUser, ...data });\n  };\n\n  return (\n    \u003Cform onSubmit={(e) => { e.preventDefault(); handleSubmit(\u002F* data *\u002F); }}>\n      {\u002F* Form fields *\u002F}\n    \u003C\u002Fform>\n  );\n}\n```\n\n---\n\n## Part 7: Performance Optimization\n\n### Code Splitting with React.lazy\n\n```typescript\nimport { lazy, Suspense } from 'react';\n\n\u002F\u002F Lazy load components\nconst Dashboard = lazy(() => import('.\u002Fpages\u002FDashboard'));\nconst Reports = lazy(() => import('.\u002Fpages\u002FReports'));\nconst Settings = lazy(() => import('.\u002Fpages\u002FSettings'));\n\nfunction App() {\n  return (\n    \u003CSuspense fallback={\u003CLoadingSpinner \u002F>}>\n      \u003CRoutes>\n        \u003CRoute path=\"\u002Fdashboard\" element={\u003CDashboard \u002F>} \u002F>\n        \u003CRoute path=\"\u002Freports\" element={\u003CReports \u002F>} \u002F>\n        \u003CRoute path=\"\u002Fsettings\" element={\u003CSettings \u002F>} \u002F>\n      \u003C\u002FRoutes>\n    \u003C\u002FSuspense>\n  );\n}\n```\n\n### Virtual Scrolling\n\n```typescript\nimport { useVirtualizer } from '@tanstack\u002Freact-virtual';\n\nfunction VirtualList({ items }: { items: Item[] }) {\n  const parentRef = useRef\u003CHTMLDivElement>(null);\n\n  const virtualizer = useVirtualizer({\n    count: items.length,\n    getScrollElement: () => parentRef.current,\n    estimateSize: () => 50, \u002F\u002F Estimated item height\n    overscan: 5, \u002F\u002F Render extra items beyond viewport\n  });\n\n  return (\n    \u003Cdiv ref={parentRef} className=\"h-96 overflow-auto\">\n      \u003Cdiv\n        style={{\n          height: `${virtualizer.getTotalSize()}px`,\n          position: 'relative',\n        }}\n      >\n        {virtualizer.getVirtualItems().map((virtualItem) => {\n          const item = items[virtualItem.index];\n          return (\n            \u003Cdiv\n              key={virtualItem.key}\n              style={{\n                position: 'absolute',\n                top: 0,\n                left: 0,\n                width: '100%',\n                height: `${virtualItem.size}px`,\n                transform: `translateY(${virtualItem.start}px)`,\n              }}\n            >\n              {\u002F*\n...existing code...\n*\u002F}\n            \u003C\u002Fdiv>\n          );\n        })}\n      \u003C\u002Fdiv>\n    \u003C\u002Fdiv>\n  );\n}\n```\n\n---\n\n## Part 8: Testing with React Testing Library\n\n```typescript\nimport { render, screen, fireEvent, waitFor } from '@testing-library\u002Freact';\nimport { expect } from 'vitest';\nimport userEvent from '@testing-library\u002Fuser-event';\n\ndescribe('Button Component', () => {\n  it('renders children correctly', () => {\n    render(\u003CButton>Click Me\u003C\u002FButton>);\n    expect(screen.getByText('Click Me')).toBeInTheDocument();\n  });\n\n  it('calls onClick handler when clicked', async () => {\n    const user = userEvent.setup();\n    const handleClick = vi.fn();\n\n    render(\u003CButton onClick={handleClick}>Click Me\u003C\u002FButton>);\n\n    await user.click(screen.getByText('Click Me'));\n    expect(handleClick).toHaveBeenCalledTimes(1);\n  });\n\n  it('is disabled when disabled prop is true', () => {\n    render(\u003CButton disabled>Cannot Click\u003C\u002FButton>);\n    expect(screen.getByRole('button')).toBeDisabled();\n  });\n});\n\ndescribe('UseFetch Hook', () => {\n  it('fetches data and returns it', async () => {\n    const { result } = renderHook(() => useFetch('\u002Fapi\u002Ftest'));\n\n    await waitFor(() => {\n      expect(result.current.data).toBeDefined();\n      expect(result.current.loading).toBe(false);\n    });\n  });\n});\n```\n\n---\n\n## Modern Component and Testing Examples\n\n### Server Components\n```tsx\nexport async function OrdersPanel() {\n  const orders = await getOrders();\n  return \u003COrdersTable orders={orders} \u002F>;\n}\n```\n\n### Error Boundaries\n```tsx\nimport { ErrorBoundary } from 'react-error-boundary';\n\n\u003CErrorBoundary fallbackRender={() => \u003Cp>Could not load dashboard.\u003C\u002Fp>}>\n  \u003CDashboard \u002F>\n\u003C\u002FErrorBoundary>\n```\n\n### Accessibility Testing Tools\n```tsx\nimport { axe } from 'jest-axe';\n\ntest('dialog passes axe checks', async () => {\n  const { container } = render(\u003CAccountDialog open \u002F>);\n  expect(await axe(container)).toHaveNoViolations();\n});\n```\n\n## React Development Best Practices\n\n### Components\n- [ ] Use functional components with hooks\n- [ ] Keep components small and focused\n- [ ] Use TypeScript for type safety\n- [ ] Implement proper error boundaries\n- [ ] Add loading and error states\n\n### Hooks\n- [ ] Follow rules of hooks (only call at top level)\n- [ ] Use custom hooks for reusable stateful logic\n- [ ] Memoize expensive computations and callbacks\n- [ ] Clean up side effects properly\n\n### Performance\n- [ ] Implement code splitting for large bundles\n- [ ] Use virtual scrolling for long lists\n- [ ] Debounce\u002Fthrottle user input\n- [ ] Lazy load images and resources\n\n### Accessibility\n- [ ] Use semantic HTML elements\n- [ ] Ensure keyboard navigation works\n- [ ] Add ARIA labels where needed\n- [ ] Support screen readers properly\n- [ ] Test with accessibility tools\n\n---\n\n## Common Pitfalls\n\n- Fetching everything in client effects by default: Server-first data loading is usually simpler, faster, and easier to cache.\n- Overusing memoization without a profiler: Manual memoization adds complexity and can hide stale-prop bugs.\n- Skipping accessible names and keyboard flows: Components can appear done while still failing real user interaction paths.\n\n## References & Resources\n\n### Documentation\n- [Hooks Reference](.\u002Freferences\u002Fhooks-reference.md) — All 17 React hooks including React 19 new hooks (use, useFormStatus, useOptimistic)\n- [Patterns Catalog](.\u002Freferences\u002Fpatterns-catalog.md) — 12 React component patterns with TypeScript examples\n\n### Scripts\n- [Component Generator](.\u002Fscripts\u002Fcomponent-generator.ps1) — PowerShell component scaffolder with types: functional, page, layout, context\n\n### Examples\n- [Custom Hooks Gallery](.\u002Fexamples\u002Fcustom-hooks-gallery.md) — 12 production-ready custom hooks with full implementations and tests\n\n---\n\n## Related Skills\n\n- [javascript-development](..\u002Fjavascript-development\u002FSKILL.md): Use it when the workflow also needs modern JavaScript and TypeScript application code.\n- [nextjs-development](..\u002Fnextjs-development\u002FSKILL.md): Use it when the workflow also needs Next.js App Router and server-first React patterns.\n- [web-testing](..\u002Fweb-testing\u002FSKILL.md): Use it when the workflow also needs browser and end-to-end testing evidence.\n- [code-quality](..\u002Fcode-quality\u002FSKILL.md): Use it when the workflow also needs two-stage review (spec compliance first, then code quality), maintainability, and refactoring guidance.\n",{"name":5,"tags":25,"version":31,"description":7,"last_updated":32},[26,27,28,29,30],"react","development","testing","quality","automation","2.0",1788825600000,"master","fd76f882a04e445e899d5cfb2732f2105ea054ee","skills\u002Fagent-skills\u002Freact-development",0,"https:\u002F\u002Fgithub.com\u002Fbg-szy\u002FTOP-SKILLS","https:\u002F\u002Fbg-szy.github.io\u002FTOP-SKILLS\u002F","https:\u002F\u002Fgithub.com\u002Fbg-szy","https:\u002F\u002Fwww.ecust.edu.cn\u002F","a student of East China University of Science and Technology","2026-11-15 03:38:02",{"source":8,"skillName":5,"commands":44,"prompt":54,"zipAvailable":55},[45,48,51],{"tool":46,"command":47},"npx","npx skills add bg-szy\u002FTOP-SKILLS --skill react-development",{"tool":49,"command":50},"bunx","bunx skills add bg-szy\u002FTOP-SKILLS --skill react-development",{"tool":52,"command":53},"pnpm","pnpm dlx skills add bg-szy\u002FTOP-SKILLS --skill react-development","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fbg-szy\u002FTOP-SKILLS\u002Fblob\u002Fmaster\u002Fskills\u002Fagent-skills\u002Freact-development\u002FSKILL.md",true,[57,63],{"path":58,"resourceType":59,"resourceTypeDesc":60,"sizeBytes":61,"sourceHtmlUrl":62},"CHANGELOG.md","REFERENCE","参考文档",6607,"https:\u002F\u002Fgithub.com\u002Fbg-szy\u002FTOP-SKILLS\u002Fblob\u002Fmaster\u002Fskills\u002Fagent-skills\u002Freact-development\u002FCHANGELOG.md",{"path":64,"resourceType":65,"resourceTypeDesc":66,"sizeBytes":67,"sourceHtmlUrl":16},"LICENSE.txt","LICENSE","许可证",1069,[69,77,84,91,98,105],{"skillNo":70,"name":71,"nameZh":6,"description":72,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":73,"categories":74,"keywords":75,"publishedAt":76},"01M7DXW9N826PKXK174PVW3038","serpmaven","Scrape Google search results (SERP) to JSON with SERP Maven (serpmaven) - a real Chrome browser on a residential proxy with sticky sessions. Run it as a CLI, a Python library, a local HTTP search API (`serve`), an MCP server or a Docker image; set the proxy login, workers, pages and cost tracking. Use when the user wants Google results, rank tracking, a self-hosted SERP API, or live Google search for an AI agent.","https:\u002F\u002Fgithub.com\u002Fbg-szy\u002FTOP-SKILLS\u002Fblob\u002Fmaster\u002Fskills\u002Fmarketplace\u002Fserpmaven\u002FSKILL.md",[],[],"2026-11-15 14:19:17",{"skillNo":78,"name":79,"nameZh":6,"description":80,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":81,"categories":82,"keywords":83,"publishedAt":76},"01M7DXVHSTWDV65475QEQ915M7","revnu-landing-page-audit","Find out why a landing page isn't turning visitors into signups, demos or sales. Audits one page against what the ad, post or search that sends people there promised, then checks the first screen, proof, call to action, friction and mobile. Returns at most 7 prioritized fixes, plus what is fine and what could not be checked; rewrites specific lines and fixes the page in the repo when asked. Never promises a conversion lift. Works without a Revnu account. Use when the user says or asks: \"audit my landing page\", \"why isn't this page converting\", \"review my homepage\", \"my ads get clicks but no signups\", \"people bounce from the pricing page\", \"CRO review\", \"improve conversion rate\", \"is my hero section clear\", \"roast my landing page\", \"rewrite my headline\", \"what's wrong with this page\", \"landing page feedback\", \"make the signup page convert better\". Not for SEO or AI-search audits, page speed engineering on its own, or building a new page from scratch.","https:\u002F\u002Fgithub.com\u002Fbg-szy\u002FTOP-SKILLS\u002Fblob\u002Fmaster\u002Fskills\u002Fmarketplace\u002Frevnu-landing-page-audit\u002FSKILL.md",[],[],{"skillNo":85,"name":86,"nameZh":6,"description":87,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":88,"categories":89,"keywords":90,"publishedAt":76},"01M7DXV8X2D7B3VTD4HHYYHTGR","revnu-growth-context","Write down once who buys, what they're stuck on, what it costs, what proof you have and what you've already tried, so every growth task starts from facts instead of a questionnaire. Creates or updates .agents\u002Frevnu-growth.md from the repo, the live site and the user, and imports an existing product-marketing.md. Use when the user says \"set up our marketing context\", \"who is our ideal customer\", \"write our ICP\", \"describe the product for marketing\", \"positioning doc\", \"what's our brand voice\", \"remember this about our customers\", \"log what we tried\", \"what have we learned from marketing\", \"we changed pricing, update the context\", \"update our growth notes\", \"summarize the business for the agent\", \"import my product-marketing.md\", \"start a growth doc\", or before a first marketing, SEO, outreach or launch task when no context file exists. Works without a Revnu account.","https:\u002F\u002Fgithub.com\u002Fbg-szy\u002FTOP-SKILLS\u002Fblob\u002Fmaster\u002Fskills\u002Fmarketplace\u002Frevnu-growth-context\u002FSKILL.md",[],[],{"skillNo":92,"name":93,"nameZh":6,"description":94,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":95,"categories":96,"keywords":97,"publishedAt":76},"01M7DXV0DGJ1G0A60PAHC6J3C5","revnu-get-listed","Get onto the third-party pages AI answers and search cite when buyers ask for the best tool in your category: \"best X\" roundups, directories, review sites, GitHub awesome lists, community threads and comparison pages. Finds which ones are cited, ranks them by fit and effort, and drafts each submission, PR or pitch by the target's own rules. Use when the user says \"get us listed\", \"which directories should we submit to\", \"how do we get into best-of lists\", \"why does ChatGPT recommend competitors and not us\", \"get mentioned in AI answers\", \"submit to awesome lists\", \"get on G2\", \"where are our competitors listed\", \"pitch listicle authors\", \"find backlink opportunities\", \"launch directories\", \"get into roundups\", \"Product Hunt alternatives\", \"where should we be listed\", \"get cited by Perplexity\". Never submits, pays or posts without a yes. Works without a Revnu account.","https:\u002F\u002Fgithub.com\u002Fbg-szy\u002FTOP-SKILLS\u002Fblob\u002Fmaster\u002Fskills\u002Fmarketplace\u002Frevnu-get-listed\u002FSKILL.md",[],[],{"skillNo":99,"name":100,"nameZh":6,"description":101,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":102,"categories":103,"keywords":104,"publishedAt":76},"01M7DXTSPMGT9D6DSS0HP9BSTA","revnu-ai-readiness-audit","Audit whether your website gives ChatGPT, Perplexity, Claude, Gemini and Google's AI Overviews something worth quoting, and fix the pages that don't. Use when the user says or asks \"is my site ready for AI search\", \"audit my site for AI answers\", \"AEO audit\", \"GEO audit\", \"why doesn't ChatGPT quote our pricing\", \"make our pages citable by AI\", \"do I need llms.txt\", \"does schema help with ChatGPT\", \"check our structured data\", \"is our content visible without JavaScript\", \"AI SEO audit\", \"optimize our homepage for AI answers\", \"LLM SEO check\", \"why does AI get our product wrong\", \"fix our site for AI Overviews\". Checks fetchability and indexability, answers in the raw HTML, entity facts, schema (including JS-injected markup), headings, dates and llms.txt, then gives at most 10 prioritised fixes and edits the repo when asked. Works without a Revnu account.","https:\u002F\u002Fgithub.com\u002Fbg-szy\u002FTOP-SKILLS\u002Fblob\u002Fmaster\u002Fskills\u002Fmarketplace\u002Frevnu-ai-readiness-audit\u002FSKILL.md",[],[],{"skillNo":106,"name":107,"nameZh":6,"description":108,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":109,"categories":110,"keywords":111,"publishedAt":76},"01M7DXSZHCVTRS620GC3S97JZV","proxy-troubleshooting","Diagnose residential proxy failures, with NodeMaven's gateway as the reference - 407 with correct credentials, 406, 410, 500, a connection that hangs, ERR_TUNNEL_CONNECTION_FAILED in a browser, Playwright or Puppeteer ignoring proxy credentials, a sticky session that changes IP, geo-targeting that is silently ignored, passwords with special characters, and unexpected traffic from headless Chrome. Use when a proxy connection fails, returns the wrong location, or costs more traffic than expected.","https:\u002F\u002Fgithub.com\u002Fbg-szy\u002FTOP-SKILLS\u002Fblob\u002Fmaster\u002Fskills\u002Fmarketplace\u002Fproxy-troubleshooting\u002FSKILL.md",[],[]]