# react Modern React (19+) patterns: hooks discipline, Suspense, transitions, no class components. ```bash npx rulepack add react ``` ## What it covers - Function components only — no `class`, no `this`, no lifecycle methods; small functions with explicit prop types - Hooks discipline: call at the top level, `useState`/`useReducer`/`useContext` chosen by need, and `useMemo`/`useCallback` only when profiling justifies it (React 19's compiler covers most cases) - Async with `Suspense` boundaries and `use()` instead of bespoke loading flags, plus `startTransition` for non-urgent updates - Refs via `useRef` for DOM nodes and mutable boxes; never read `.current` during render - Anti-patterns to avoid: derived state in `useState`, mutating props, effects that only sync state to state, and index keys on reorderable lists ## Source Rules align with the official React documentation: https://react.dev/learn ## License MIT