Packages

react

19.3.1 · 14 Oct 2026MIT275.7M / weekRepositoryHomepagenpmAtom feed

Your version

19.0.0

major5 Dec 2024Where it was published

19.3.1 is the newest release of 19.x.

Summary· from the note as AI read it

Migration neededRead before upgrading: 10 changes to make.

Before you upgrade

  • Uncaught render errors no longer rethrown; use onUncaughtError/onCaughtError if needed
  • propTypes are ignored; migrate to TypeScript or another type checker
  • Replace defaultProps on function components with ES6 default parameters
  • Migrate legacy contextTypes/getChildContext to the contextType API
  • Migrate string refs to ref callbacks
  • Migrate module pattern factories to regular function components
  • Replace React.createFactory calls with JSX
  • Check ref callbacks tolerate double invocation in StrictMode

New minimums

  • Configure your build to use the new JSX transform
  • Load React via an ESM-based CDN instead of UMD builds

Deprecated

  • Stop accessing element.ref; read ref from props instead
  • Pass key explicitly instead of spreading it with props

New

  • Actions: startTransition can now accept async functions. Functions passed to startTransition are called “Actions”. A given Transition can include one or more Actions which update state in the background and update the UI with one commit. In addition to updating state, Actions can now perform side effects including async requests, and the Action will wait for the work to finish before finishing the Transition. This feature allows Transitions to include side effects like fetch() in the pendi
  • useActionState: is a new hook to order Actions inside of a Transition with access to the state of the action, and the pending state. It accepts a reducer that can call Actions, and the initial state used for first render. It also accepts an optional string that is used if the action is passed to a form action prop to support progressive enhancement in forms.
  • useOptimistic: is a new hook to update state while a Transition is in progress. It returns the state, and a set function that can be called inside a transition to “optimistically” update the state to expected final value immediately while the Transition completes in the background. When the transition finishes, the state is updated to the new value.
  • use: is a new API that allows reading resources in render. In React 19, use accepts a promise or Context. If provided a promise, use will suspend until a value is resolved. use can only be used in render but can be called conditionally.
  • ref as a prop: Refs can now be used as props, removing the need for forwardRef.

In short

7 breaking15 removed2 deprecated25 new6 faster16 fixed

  • Breaking

    New JSX Transform is now required: We introduced a new JSX transform in 2020 to improve bundle size and use JSX without importing React. In React 19, we’re adding additional improvements like using ref as a prop and JSX speed improvements that require the new transform.

  • Breaking

    Errors in render are not re-thrown: Errors that are not caught by an Error Boundary are now reported to window.reportError. Errors that are caught by an Error Boundary are reported to console.error. We’ve introduced onUncaughtError and onCaughtError methods to createRoot and hydrateRoot to customize this error handling.

  • Breaking

    StrictMode changes: useMemo and useCallback will now reuse the memoized results from the first render, during the second render. Additionally, StrictMode will now double-invoke ref callback functions on initial mount.

  • Breaking

    Don’t rethrow errors at the root

  • Breaking

    Refs are now attached/detached/attached in StrictMode

  • Breaking

    Reuse memoized result from first pass

  • Breaking

    Rename the react.element symbol to react.transitional.element

  • Removed

    Removed: propTypes: Using propTypes will now be silently ignored. If required, we recommend migrating to TypeScript or another type-checking solution.

Release note

The section about react of a note shared by several packages.

New Features

React

  • Actions: startTransition can now accept async functions. Functions passed to startTransition are called “Actions”. A given Transition can include one or more Actions which update state in the background and update the UI with one commit. In addition to updating state, Actions can now perform side effects including async requests, and the Action will wait for the work to finish before finishing the Transition. This feature allows Transitions to include side effects like fetch() in the pending state, and provides support for error handling, and optimistic updates.

  • useActionState: is a new hook to order Actions inside of a Transition with access to the state of the action, and the pending state. It accepts a reducer that can call Actions, and the initial state used for first render. It also accepts an optional string that is used if the action is passed to a form action prop to support progressive enhancement in forms.

  • useOptimistic: is a new hook to update state while a Transition is in progress. It returns the state, and a set function that can be called inside a transition to “optimistically” update the state to expected final value immediately while the Transition completes in the background. When the transition finishes, the state is updated to the new value.

  • use: is a new API that allows reading resources in render. In React 19, use accepts a promise or Context. If provided a promise, use will suspend until a value is resolved. use can only be used in render but can be called conditionally.

  • ref as a prop: Refs can now be used as props, removing the need for forwardRef.

  • Suspense sibling pre-warming: When a component suspends, React will immediately commit the fallback of the nearest Suspense boundary, without waiting for the entire sibling tree to render. After the fallback commits, React will schedule another render for the suspended siblings to “pre-warm” lazy requests.

Breaking Changes

React

  • Breaking

    New JSX Transform is now required: We introduced a new JSX transform in 2020 to improve bundle size and use JSX without importing React. In React 19, we’re adding additional improvements like using ref as a prop and JSX speed improvements that require the new transform.

  • Breaking

    Errors in render are not re-thrown: Errors that are not caught by an Error Boundary are now reported to window.reportError. Errors that are caught by an Error Boundary are reported to console.error. We’ve introduced onUncaughtError and onCaughtError methods to createRoot and hydrateRoot to customize this error handling.

  • Breaking

    Removed: propTypes: Using propTypes will now be silently ignored. If required, we recommend migrating to TypeScript or another type-checking solution.

  • Breaking

    Removed: defaultProps for functions: ES6 default parameters can be used in place. Class components continue to support defaultProps since there is no ES6 alternative.

  • Breaking

    Removed: contextTypes and getChildContext: Legacy Context for class components has been removed in favor of the contextType API.

  • Breaking

    Removed: string refs: Any usage of string refs need to be migrated to ref callbacks.

  • Breaking

    Removed: Module pattern factories: A rarely used pattern that can be migrated to regular functions.

  • Breaking

    Removed: React.createFactory: Now that JSX is broadly supported, all createFactory usage can be migrated to JSX components.

  • Breaking

    Removed: react-test-renderer/shallow: This has been a re-export of react-shallow-renderer since React 18. If needed, you can continue to use the third-party package directly. We recommend using @testinglibrary.com/docs/react-testing-library/intro/) or @testingesting-library.com/docs/react-native-testing-library/intro) instead.

Notable Changes

React

  • <Context> as a provider: You can now render <Context> as a provider instead of <Context.Provider>.

  • Cleanup functions for refs: When the component unmounts, React will call the cleanup function returned from the ref callback.

  • useDeferredValue initial value argument: When provided, useDeferredValue will return the initial value for the initial render of a component, then schedule a re-render in the background with the deferredValue returned.

  • Support for Custom Elements: React 19 now passes all tests on Custom Elements Everywhere.

  • StrictMode changes: useMemo and useCallback will now reuse the memoized results from the first render, during the second render. Additionally, StrictMode will now double-invoke ref callback functions on initial mount.

  • Removed

    UMD builds removed: To load React 19 with a script tag, we recommend using an ESM-based CDN such as esm.sh.

All Changes

React

A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.