Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4133 pages

Upgrades and deprecations

Upgrade React 18 to 19: What Breaks, What Goes Quiet, Which Codemods Help

In short

Before you upgrade React 18 to 19, know that one removal fails silently: `propTypes` checks are simply ignored, so validation stops without an error. The rest are loud, from `ReactDOM.render` to string refs and legacy context. The official route is 18.3 first, which warns about each of them, then the React 19 codemod recipe and a separate types codemod.

What should be done before you upgrade React 18 to 19?

Two things, both from the official upgrade guide. The new JSX transform introduced in 2020 is now required, because ref as a prop and the JSX speed work depend on it. Most toolchains already use it, and React 19 prints an outdated-transform error if yours does not.

The second is a stop at React 18.3. The changelog describes 18.3.0 as identical to 18.2 apart from warnings for APIs that React 19 needs gone. It warns about findDOMNode and legacy context and string refs outside StrictMode, defaultProps on function components, spreading key, act from test-utils and unmountComponentAtNode. A console that stays clean on 18.3 is the closest thing the docs offer to a readiness check.

The target moves on its own. react.dev lists 19.3 as the latest version, released on 9 September 2026, and the npm registry tags 19.3.1 as latest.

Checked against: source 1, source 3, source 4

Which APIs are gone in React 19, and does a codemod cover each one?

Every row is a removal the guide lists, with the version that first deprecated it and whether the guide names a codemod. A blank codemod cell means the guide shows a manual rewrite only.

RemovedDeprecated inReplace withCodemod in the guide
`propTypes` checks15.5 (2017)TypeScript or another type checker`react/prop-types-typescript`
`defaultProps` on function componentsWarned in 18.3ES6 default parameters (classes keep `defaultProps`)None
Legacy context (`contextTypes`, `getChildContext`)16.6 (2018)`static contextType`None
String refs16.3 (2018)Ref callbacks`react/19/replace-string-ref`
Module pattern factories, `React.createFactory`16.9 (2019), 16.13 (2020)Plain functions, JSXNone
`react-dom/test-utils`Warned in 18.3`act` from `react``react/19/replace-act-import`
`ReactDOM.render`, `ReactDOM.hydrate`18.0 (2022)`createRoot`, `hydrateRoot``react/19/replace-reactdom-render`
`unmountComponentAtNode`18.0 (2022)`root.unmount()``react/19/replace-reactdom-render`
`ReactDOM.findDOMNode`16.6 (2018)DOM refsNone
`react-test-renderer/shallow`Re-export since 18The `react-shallow-renderer` packageNone

Checked against: source 1

What changes about refs, context and errors?

Function components can now read ref as an ordinary prop, so new components no longer need forwardRef; the release post says forwardRef will be deprecated and removed in a later version. Reading element.ref now warns, and the value lives at element.props.ref. A ref callback may return a cleanup function, and when it does React skips the old call with null on unmount.

Context gets a shorter provider: <Context> can be rendered where <Context.Provider> was, and the provider form is due for deprecation in a future version. The old class API, contextTypes with getChildContext, is removed outright, not deprecated.

Errors thrown during render are no longer re-thrown. Uncaught ones go to window.reportError and caught ones to console.error, and createRoot and hydrateRoot accept onUncaughtError and onCaughtError. If your error reporting relied on the re-throw, it needs those options. Also renamed: useFormState is deprecated in favour of useActionState.

If a class component still calls findDOMNode, this fix page shows the ref-based rewrite.

Checked against: source 1, source 2

Which commands do the official codemods run?

The guide recommends the codemod CLI over running react-codemod directly. The recipe bundles five transforms: replace-reactdom-render, replace-string-ref, replace-act-import, replace-use-form-state and prop-types-typescript. Type changes are a separate tool, types-react-codemod, with its own preset.

npm install --save-exact react@^19.0.0 react-dom@^19.0.0
npm install --save-exact @types/react@^19.0.0 @types/react-dom@^19.0.0
npx codemod@latest react/19/migration-recipe
npx types-react-codemod@latest preset-19 ./path-to-app

Checked against: source 1

Which TypeScript errors should you expect after the bump?

useRef now requires an argument, and every ref it returns is mutable: MutableRefObject is deprecated in favour of a single RefObject. A ref callback written as an implicit return, such as current => (instance = current), is rejected because TypeScript cannot tell it apart from a cleanup function.

ReactElement props now default to unknown instead of any, which surfaces every place that reads element.props without a type. The global JSX namespace is gone; augmentations must sit inside declare module for the JSX runtime set in tsconfig. useReducer no longer takes the whole reducer type as its type argument.

The preset-19 run handles most of these, and the guide offers an extra react-element-default-any-props transform for codebases with much unsound props access. If TypeScript says ref does not exist on a component's props, see this fix page.

Checked against: source 1, source 2

Can a dependency block the upgrade even if your code is ready?

Yes, and the guide says so plainly. Libraries that reach into React internals may break, and because internals are outside the versioning policy, those breaks are not listed as breaking changes. The internals suffix was renamed to _DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE to make the point.

Testing code is the other usual blocker. react-test-renderer now logs a deprecation warning and renders concurrently, and the guide points to Testing Library instead. UMD builds are no longer produced, so a page loading React from a script tag needs an ESM CDN.

Before running the codemods, I would check each React-dependent package's peer range. This page covers npm refusing a library over peerDependencies, and this one a PDF library that broke after a React upgrade.

Checked against: source 1

What else do people ask?

Will propTypes throw an error in React 19?

No. According to the upgrade guide, React 19 drops the checks entirely and a <code>propTypes</code> object on a component is ignored without a message. Components keep rendering, so the loss only shows up as missing warnings. The <code>react/prop-types-typescript</code> codemod moves them to TypeScript.

Is forwardRef removed in React 19?

Not yet. Function components can take <code>ref</code> as a prop, and the release post says forwardRef will be deprecated and removed in a future version. Existing forwardRef components keep working on 19.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. This page reads React's own documents, fetched on 20 Nov 2026 (the React 19 upgrade guide, the React 19 release post, the 18.3 changelog entry and the versions page). I did not upgrade an app for it. It does not cover Next.js, React Native, the React Compiler or any one library's own React 19 support. Found a mistake? Tell me.

Keep reading

Next step

Have a project in mind?

Tell me about it. A discovery call within 48 hours.