Upgrading react 18 to 19
Breaking18.3.1 → 19.3.1Breaking50Security3Platform1Deprecated3New107Changed106Fixed154Other5
BreakingUpgrade verdict
50 breaking changes and a platform requirement change and 3 security fixes.
In plain terms
- If you use the plugin's recommended settings, you now get the flat config format by default; the old format is under a new name.
- Code that called React.act in production builds will break because it is now only available in development.
- Passing an HTML comment as the container to render into no longer works.
- Rendering errors are now reported to the browser or console instead of being thrown again, and you can customize how they are handled.
Must act Top 5 of 57 that need code or config changes
react publishes an official migration guide for version 19. It covers more than the release notes do.
React 19 upgrade guide ↗Drops loose-envify.
Installs 0 packages in all (was 2).
What you must change
Breaking50
Flat config becomes the default recommended preset; legacy config moves to recommended-legacy.
recommendedrecommended-legacyFixes dev-only methods being exported in production builds; React.act is no longer available in production builds.
React.actRemoves support for using HTML comments (e.g. <!-- -->) as a DOM container.
Errors in render are no longer re-thrown; uncaught errors go to window.reportError and caught ones to console.error, customizable via onUncaughtError and onCaughtError.
onUncaughtErroronCaughtErrorcreateRoothydrateRootpropTypes is removed and silently ignored; migrate to TypeScript or another type-checking solution.
propTypesdefaultProps for function components is removed; use ES6 default parameters instead. Class components still support defaultProps.
defaultPropscontextTypes and getChildContext are removed; legacy Context for class components is replaced by the contextType API.
contextTypesgetChildContextcontextTypeString refs are removed; migrate any usage to ref callbacks.
Module pattern factories are removed; migrate to regular functions.
React.createFactory is removed; migrate all createFactory usage to JSX components.
React.createFactoryReactDOM.render and ReactDOM.hydrate are removed in favor of ReactDOM.createRoot and ReactDOM.hydrateRoot.
ReactDOM.renderReactDOM.hydrateReactDOM.createRootReactDOM.hydrateRootunmountComponentAtNode is removed in favor of root.unmount().
unmountComponentAtNoderoot.unmount()ReactDOM.findDOMNode is removed; replace it with DOM refs.
ReactDOM.findDOMNodeUMD builds are removed; load React 19 with an ESM-based CDN such as esm.sh instead.
Removes deprecated TypeScript types ReactChild, ReactFragment, ReactNodeArray, ReactText, VoidFunctionComponent and VFC.
ReactChildReactFragmentReactNodeArrayReactTextVoidFunctionComponentVFCReactElement props now default to unknown instead of any when the element is typed as ReactElement.
ReactElementRemoves the global JSX namespace; JSX is now available from the React package via import { JSX } from 'react'.
JSXRenames the react.element symbol to react.transitional.element.
react.elementreact.transitional.elementRemoves string refs.
Removes Legacy Context.
contextTypeschildContextTypesRemoves RefreshRuntime.findAffectedHostInstances.
RefreshRuntime.findAffectedHostInstancesRemoves client caching from the cache() API.
cache()Removes propTypes.
propTypesRemoves defaultProps support, except for classes.
defaultPropsRemoves UMD builds.
Removes
createFactory from React.createFactoryRemoves legacy React DOM APIs and moves createRoot and hydrateRoot to react-dom/client.
renderhydratefindDOMNodeunmountComponentAtNodeunstable_createEventHandleunstable_renderSubtreeIntoContainerunstable_runWithPrioritycreateRootRemoves unstable_flushControlled.
unstable_flushControlledRemoves legacy mode.
Removes renderToStaticNodeStream().
renderToStaticNodeStream()Removes unstable_renderSubtreeIntoContainer.
unstable_renderSubtreeIntoContainerRenames the secret export of Client and Server internals.
Removes errorInfo.digest from onRecoverableError.
onRecoverableErrorerrorInfo.digestRemoves prepareUpdate from React Reconciler.
prepareUpdateRemoves isConcurrentMode and isAsyncMode methods from react-is.
isConcurrentModeisAsyncModeRemoves React internals access from useSyncExternalStore.
useSyncExternalStoreReleases eslint-plugin-react-hooks 6.1.0 as the first official 6.x major release with breaking changes.
eslint-plugin-react-hooksUpdates useId to use valid CSS selectors, changing the format from :r123: to «r123».
useIdThe new JSX transform is now required, enabling ref as a prop and JSX speed improvements.
react-test-renderer/shallow is removed; use the third-party react-shallow-renderer or React Testing Library instead.
react-test-renderer/shallowreact-dom/test-utils is removed; act moved to react and all other utilities are removed.
react-dom/test-utilsactMoves Requireable, ValidationMap, Validator and WeakValidationMap types to prop-types.
RequireableValidationMapValidatorWeakValidationMapMoves ClassicComponentClass, ClassicComponent, ClassicElement, ComponentSpec, Mixin, ReactChildren, ReactHTML, ReactSVG and SFCFactory types to create-react-class.
ClassicComponentClassClassicComponentClassicElementComponentSpecMixinReactChildrenReactHTMLReactSVGDisallows implicit returns in refs since refs can now accept cleanup functions; implicit returns of non-functions now error.
Requires the initial argument to useRef, matching useState and createContext.
useRefuseStatecreateContextRef objects returned from useRef() are now always mutable instead of sometimes immutable.
useRef()Throws an error if react and react-dom versions do not match.
reactreact-domRemoves test-utils.
test-utilsRemoves the react-test-renderer/shallow export.
react-test-renderer/shallowAdjusts parameter order of
createContainer and createHydrationContainer after on* handlers for upcoming experimental APIs.createContainercreateHydrationContainerSecurity3
Patches Promise cycles and toString on Server Functions.
toStringServer FunctionsAdds more DoS mitigations to Server Actions and hardens Server Components.
Server ActionsServer ComponentsReplaces javascript: URLs with functions that throw errors.
Platform1
eslint-plugin-react-hooks@6.1.0 requires Node.js 18 or newer.
Deprecations to plan for
Deprecated3
Deprecates element.ref access in favor of element.props.ref, warning when accessed.
element.refelement.props.refreact-test-renderer logs a deprecation warning and switches to concurrent rendering for web usage.
react-test-rendererAdds a deprecation error to react-test-renderer on web.
react-test-renderer