Logo Ekbal's Blog

Search Blog

React 19: What’s New

May 1, 2025
4 min read
index

React Compiler

React 19 introduces a brand-new React Compiler, which transforms components at build time to automatically optimize them. The compiler allows React to eliminate unnecessary re-renders without relying on memo, useMemo, or useCallback.

This means developers can now write cleaner, simpler code without sacrificing performance. It works by analyzing how components use props and state and generates optimized code accordingly.

🚀 “The compiler understands your components and rewrites them for you — it’s like having an optimizing assistant in your build step.”

This is currently experimental but expected to become the standard in future releases.

useEffect behavior changes

In React 19, useEffect has become more predictable. Previously, effects might fire in situations where nothing had changed — now, React uses a more accurate dependency comparison and lifecycle management.

Key changes:

  • Effects no longer run unnecessarily if nothing has changed.
  • Mount/unmount behavior has been streamlined, especially in Strict Mode.

This leads to fewer bugs and surprises in real-world apps.

Actions and Forms

React 19 introduces Actions, a new way to handle form submissions and mutations. This improves how forms work across both client and server components.

Example:

<form action={myAction}>
<input name="email" />
<button>Submit</button>
</form>

Actions can now return validation results, server responses, or even trigger optimistic UI updates. This feature aligns well with frameworks like Next.js App Router and Remix, which already leverage similar abstractions.

Server Components Improvements

React 19 enhances support for Server Components with better streaming, context handling, and developer experience. Combined with the compiler, this helps make server-rendered apps faster and more maintainable.

useOptimistic and useFormStatus

React 19 introduces new hooks for form interactions:

  • useOptimistic() — For optimistic UI updates.
  • useFormStatus() — For tracking submission status and errors.

These hooks make it easier to build rich, interactive UIs with less boilerplate.

New use API

With the use function, you can unwrap promises and context right when the component renders. It’s kind of like a React hook, but you can actually use it inside loops or conditionals.

import { Suspense, use } from "react";
function NameList({ getNames }) {
// `use` will suspend until the promise resolves
const names = use(getNames());
return (
<ul>
{names.map((item) => (
<li key={item.id}>{item.title}</li>
))}
</ul>
);
}
function ApplicantNames({ getNames }) {
return (
// When `use` suspends in NameList, this Suspense boundary will be shown
<Suspense fallback={<div>Loading...</div>}>
<NameList getNames={getNames} />
</Suspense>
);
}

Updated useDeferredValue hook

An initialValue option has been introduced to useDeferredValue. When specified, the hook will return this initial value during the first render and then trigger a background re-render to update with the actual deferred value.

function Search({ deferredValue }) {
// Initially renders with an empty string as the value.
// A re-render is then triggered with the deferred value.
const value = useDeferredValue(deferredValue, "");
return <Results value={value} />;
}

Conclusion

React 19 is a significant release aimed at simplifying performance, state, and form handling. With the introduction of the compiler, refined effect behavior, and new form primitives, it’s a great time to be a React developer.

As with any major release, it’s good to test thoroughly and read the migration docs before upgrading. But the future of React apps is looking cleaner, faster, and more ergonomic than ever!