Claude Code correction guide. Updated January 2026.
npm install react@^19.0.0 react-dom@^19.0.0
npm install -D @types/react@^19.0.0 @types/react-dom@^19.0.0
# Or with Vite (recommended for new projects):
npm create vite@latest my-app -- --template react-ts- Using manual memoization — React 19's Compiler auto-memoizes; remove unnecessary
useMemo/useCallback - Still using
forwardRef— React 19 passesrefas a prop directly to function components - Using
ReactDOM.render()— Must usecreateRoot()API for React 19 concurrent features - Importing
actfrom wrong location — Import fromreact, notreact-dom/test-utils - Using
<Context.Provider>— React 19 renders<Context>directly as provider
// React 19: ref as prop, no forwardRef needed
function Input({ ref, ...props }: { ref?: React.Ref<HTMLInputElement> }) {
return <input ref={ref} {...props} />;
}
// React 19: Context as provider directly
const ThemeContext = createContext('light');
<ThemeContext value="dark">{children}</ThemeContext>
// React 19: ref cleanup function
<div ref={(node) => {
// setup
return () => { /* cleanup */ };
}} />
// Async transitions with useTransition
const [isPending, startTransition] = useTransition();
startTransition(async () => {
await updateData();
});- v18→v19:
forwardRefdeprecated, use ref as prop - v18→v19: Context.Provider → Context directly
- v18→v19: Automatic memoization via React Compiler
- Security: Update to 19.0.3+ (CVE-2025-55184, CVE-2025-55183 patches)
- ❌
useMemo(() => expensiveCalc, [deps])everywhere — Compiler handles this - ❌
React.forwardRef((props, ref) => ...)— Just acceptrefin props - ❌
import { act } from 'react-dom/test-utils'— Useimport { act } from 'react' - ❌
useReducer<State, Action>with type args — Let TypeScript infer - ❌ Array index as
key— Use stable unique IDs
| Need | Solution |
|---|---|
| Local UI state | useState |
| Complex local | useReducer |
| Server/async | TanStack Query |
| Global client | Zustand or Jotai |
| Forms | React Hook Form + Zod |