React
React 19: what actually changes
React 19 brings Actions, useActionState, useOptimistic, ref as a prop and metadata in the core. It changes data fetching, not how you write components.
Key points
- Actions move form submission and pending state inside React, without a manual loading boolean.
- ref is an ordinary prop: forwardRef still works but is no longer needed in new components.
- The upgrade needs react and react-dom at the same version, plus a check on libraries that read removed APIs.
“React 19” moves data fetching into the library: Actions, useActionState, useOptimistic, ref as a prop and metadata handled by the core.
What enters the core
- Actions: an async function passed to a form receives the submitted data and updates state without a manual loading boolean for each request.
- useActionState: returns state, action and pending value in a single call.
- useOptimistic: shows the expected result at once and replaces it when the server answers.
- ref as a prop: function components read
reffrom props, withoutforwardRef.
The replacement table
| Before | In React 19 | Note |
|---|---|---|
| forwardRef | ref as a prop | forwardRef still works, but is deprecated for new components |
| Manual isLoading | useActionState | The pending state comes from the action |
| Hand-rolled optimistic update | useOptimistic | Rollback is automatic when the action fails |
| title and meta outside React | Metadata in the document | React hoists the tags into the head: React 19 reads them |
How to upgrade
npx codemod@latest react/19/migration-recipe
npm install react@19 react-dom@19
The codemod ships under the MIT licence and rewrites the most common patterns, from forwardRef to ref as a prop, and away from the removed propTypes. Read the diff afterwards: the codemod does not know your domain and can touch code that worked. React and React DOM must share a version, or the install fails.
What breaks
Some APIs were removed: propTypes and defaultProps on function components, string refs and ReactDOM.render. Errors thrown during render are no longer rethrown: the root catches them. Libraries that read those APIs must be updated before the deploy, not after.
A live record
In the EneUI catalogue two components show the updated code: dropdown-menu and sonner, both React under the MIT licence and without forwardRef. To browse by category start from 111,985 components.
The limitation
The ecosystem does not move at the speed of the core. A library that declares React 18 in its peer dependencies may work, but the package manager reports a conflict and nothing guarantees the behaviour. You need a rollback plan: upgrade in a branch, run the tests and compare load timings before merging.
Where to continue
The measured React libraries in the catalogue are in React libraries 2026; compatible form libraries are in React form libraries; the comparison with Vue is in Vue 3 vs React.
Frequently asked questions
Is React 19 a stable release?
Yes. React 19 is the stable release shipped in December 2024 and it replaced 18 as the current version of the documentation.
Do I have to rewrite class components?
No. Classes remain supported with no removal date. Moving to function components is a maintenance choice, not a requirement of version 19.
What replaces forwardRef?
Passing ref as an ordinary prop. The component receives ref among its props and forwards it to the element. forwardRef still works and is deprecated only for new code.
Which Next.js version is needed for React 19?
Next.js 15 and later versions support React 19. Earlier versions declare React 18 and must not be forced: framework and library stay aligned.
Can I upgrade react-dom alone?
No. react and react-dom must share a version: the renderer and the core share internal structures, and a version gap produces runtime errors.