- Actions: Automate handling of pending states, errors, forms, and optimistic updates using new hooks like
useTransition
anduseActionState
. - New API:
use
: Read resources in render, supporting conditional calls and promises. - Server Components and Server Actions: Enable async functions on the server, improving performance.
- Improved Hydration: Better error reporting and compatibility with third-party scripts.
- Enhanced Ref Handling: Simplified ref access and cleanup functions.
Getting started
Migration Steps
1
Installation
Install the latest version of React and React DOM:or, if you’re using Yarn:
2
Update types (Optional - TypeScript only)
If you’re using TypeScript, you also need to update the types. Once React 19 is released as stable, you can install the types as usual from
@types/react
and @types/react-dom
. Until the stable release, the types are available in different packages which need to be enforced in your package.json
:package.json
3
Run codemods
Run the React 19 upgrade recipe:This recipe is a set of codemods that will fix some of React 19 breaking changes.The recipe includes the following codemods:
- react/19/replace-reactdom-render
- react/19/replace-string-ref
- react/19/replace-act-import
- react/19/replace-use-form-state
- react/prop-types-typescript
react-codemod
repo.