Upgrade to React 19
React 19 is a recommended upgrade for most apps already on React 18. The risk is concentrated in removed legacy APIs (string refs, legacy context, function-component propTypes/defaultProps, findDOMNode) and test tooling.
Last verified · Updated May 22, 2026
React 19 is a recommended upgrade for apps already on React 18. Most breakage comes from removed legacy APIs and incompatible test tooling — not from rewriting your components. Budget half a day to three days depending on enzyme/string-ref usage.
Who should upgrade
- Apps on React 18 wanting Actions, form hooks, and improved hydration error messages.
- Libraries that want to drop forwardRef boilerplate.
- Teams on React 16/17 should first reach React 18, then 19.
Who should wait
- Apps with heavy enzyme test suites until those are migrated to React Testing Library.
- Apps blocked by a critical third-party library without a React 19-compatible release.
What changed
- Actions: async transitions with built-in pending/error state.
- New hooks: useActionState, useFormStatus, useOptimistic, and use().
- ref is a regular prop; forwardRef is being deprecated.
- Removed: string refs, legacy context, function-component propTypes/defaultProps, findDOMNode, and the shallow renderer.
- Improved hydration error diffs.
The upgrade rarely touches modern function components. It touches code using string refs, legacy context, findDOMNode, and propTypes/defaultProps on function components. Inspect for those first.
Recommended upgrade paths
# 1. Bump React$ npm install react@19 react-dom@19# 2. Run the official migration codemod recipe$ npx codemod@latest react/19/migration-recipe# 3. Typecheck + test$ npm run typecheck && npm test -- --watch=falseCompatibility matrix
| Concern | React 18 | React 19 |
|---|---|---|
| forwardRef | Required for ref forwarding | Optional — ref is a prop |
| propTypes (function comps) | Runtime-checked | Ignored / removed |
| String refs | Deprecated | Removed |
| Enzyme | Unsupported | Unsupported |
| Server Components | Experimental | Stable (framework-dependent) |
Upgrade this app to React 19. First inspect for removed APIs (string refs, legacy context, function-component propTypes/defaultProps, findDOMNode, shallow renderer). Then bump react/react-dom, run `npx codemod@latest react/19/migration-recipe`, fix the inspection findings, and resolve type errors. Run typecheck, lint, and tests after each step and report before continuing.
Safety: Incremental edits only. Pause for review after the codemod and after each API replacement.
PR review checklist
- react and react-dom are on the same 19.x version
- No string refs, legacy context, or findDOMNode remain
- forwardRef wrappers were only removed where the codemod is safe
- Tests no longer use the shallow renderer or enzyme
- No new React console warnings in test output
Rollback strategy
- Keep the version bump, codemod, and manual fixes in separate commits.
- Revert to react@18 react-dom@18 and reinstall if a blocking third-party incompatibility appears.
- Hold the upgrade behind a release branch until the full test suite is green.
Common errors
- 'X is not a function' after findDOMNode removal — switch to a ref.
- Hydration mismatch warnings — see the fix-react-hydration-errors workflow.
- Type errors on ref props after dropping forwardRef.
Related migration paths
- Migrate AngularJS to Reacthigh riskEarlier step in the upgrade chain
- Migrate React Class Components to Hookslow riskEarlier step in the upgrade chain
- React 16 to React 19 Migration Guidehigh riskUpgrade path to same target
- React 17 to React 19 Migration Guidehigh riskUpgrade path to same target
- React 18 to React 19 Migration Guidemedium riskUpgrade path to same target
- Fix React Hydration Errorsmedium riskEarlier step in the upgrade chain
Official sources
Backs the breaking-change and migration-step claims.
Backs the breaking-change and migration-step claims.
Backs the breaking-change and migration-step claims.
Frequently asked questions
Is React 19 a hard upgrade?
For modern React 18 apps it is usually straightforward — the official codemod handles most mechanical changes. The effort scales with how much legacy API surface (string refs, enzyme, findDOMNode) your codebase still uses.
Do I need to rewrite components to use Actions?
No. Actions and the new form hooks are opt-in. You can upgrade to React 19 without adopting them and migrate forms incrementally.