← Back to React, page 3

react-0042 · Medium mid

What are the main changes in React 19 and the later 19.x releases that you would use in everyday code?

React 19 added Actions with useActionState, useFormStatus and useOptimistic, the use API for promises and context, ref as a normal prop, context as its own provider, built-in document metadata tags, better error reporting and stable Server Components. Version 19.2 added Activity and useEffectEvent, and 19.3 added View Transitions and Fragment refs. It also removed old APIs such as propTypes for functions and ReactDOM.render.

Full answer

The most visible theme of React 19 is making async work and forms first-class.

Actions let a transition contain an async function, with pending state, errors and optimistic updates handled by React. useActionState tracks the result of an action, useFormStatus reads the parent form's pending state, and useOptimistic shows an expected result while a request is in flight. Forms accept a function in action.

The use API reads a resource during render. With a promise it suspends until the promise resolves. With a context it reads the value, and unlike useContext it may be called after an early return or inside a condition.

Smaller changes remove boilerplate. ref is a regular prop for function components, so forwardRef is not needed. A context object works as its own provider (<ThemeContext value={...}>). Ref callbacks can return cleanup functions. React elements such as <title>, <meta> and <link> can be rendered anywhere in a component and are placed in the document head. Stylesheets and scripts can declare priority and loading order, and custom elements are supported.

Error handling improved: errors are reported once, and createRoot and hydrateRoot accept onCaughtError, onUncaughtError and onRecoverableError. Hydration errors show a readable diff.

React 19.2 added Activity, which hides part of the UI while keeping its state and pausing its effects, and useEffectEvent. React 19.3 added View Transitions and Fragment refs. The React Compiler became stable separately.

Several old APIs were removed: propTypes and defaultProps on function components (use TypeScript and default parameters), string refs, legacy context, findDOMNode, and ReactDOM.render and hydrate. act now lives in the react package.

Upgrade note: install the codemods, update libraries that pass refs or read internals, and keep Server Component packages patched.

The example uses several of these features together.

jsx
import { createContext, use, useRef, useState } from 'react';

const LanguageContext = createContext('en');

function Greeting() {
  const language = use(LanguageContext);
  return <p>{language === 'hi' ? 'Namaste' : 'Hello'}</p>;
}

function NameField({ ref, label }) {
  return (
    <label>
      {label}
      <input ref={ref} />
    </label>
  );
}

export default function App() {
  const [language, setLanguage] = useState('en');
  const fieldRef = useRef(null);

  return (
    <LanguageContext value={language}>
      <title>Student portal</title>
      <meta name="description" content="Check your marks" />
      <Greeting />
      <NameField ref={fieldRef} label="Name" />
      <button onClick={() => setLanguage('hi')}>Switch language</button>
    </LanguageContext>
  );
}

The example uses use with context, ref as a prop, a context as its own provider, and title and meta tags rendered inside the component. After the click, the greeting changes. Rendered result: <p>Namaste</p><label>Name<input></label><button>Switch language</button> Document head after the run: <title>Student portal</title><meta name="description" content="Check your marks">

Key points

  • Actions: async transitions with useActionState, useFormStatus, useOptimistic and form action props.
  • use reads promises and context, and can be called conditionally.
  • ref is a normal prop, a context is its own provider, and ref callbacks can clean up.
  • Document metadata tags render from any component and are hoisted to the head.
  • 19.2 and 19.3 add Activity, useEffectEvent, View Transitions and Fragment refs. Old APIs like ReactDOM.render are removed.

Common mistakes

  • Still wrapping every component in forwardRef in new React 19 code.
  • Expecting use to work like a normal hook inside try and catch, or to accept a promise created during render.
  • Relying on defaultProps or propTypes on function components, which are no longer supported.
  • Assuming Server Components work without a framework or bundler integration.
  • Calling ReactDOM.render in a migrated project.

Follow-ups

  • How does use differ from useContext and from await?
  • What does Activity do compared with conditional rendering?
  • What did the React Compiler 1.0 release change about manual memoization?

Tips

  • Group the answer by theme (async, ergonomics, errors, removals) instead of a list of hook names.
  • State which release added each feature. Version precision signals real familiarity.
  • Mention what was removed. Migration questions often follow.