React 19 is the first major version since React 18 and it rewires how you think about async state. Instead of wiring up useEffect + useState + error boundaries manually, React 19 gives you first-class primitives for the entire async lifecycle.
React Actions
Actions are async functions that React knows about. When you pass them to <form action={fn}> or use them with the new hooks, React handles pending state, errors, and optimistic updates automatically.
use() is the escape hatch that lets you read a Promise or Context inside the render function. Unlike other hooks, it can be called inside loops and conditionals.
import { use, Suspense } from "react";
function UserCard({ userPromise }: { userPromise: Promise<User> }) {
const user = use(userPromise); // suspends while pending
return <div>{user.name}</div>;
}
// In the parent:
<Suspense fallback={<Skeleton />}>
<UserCard userPromise={fetchUser(id)} />
</Suspense>
Reading context with use() is useful inside conditional branches:
if (needsTheme) {
const theme = use(ThemeContext); // valid - hooks rules relaxed for use()
}
useOptimistic()
Show the result of a mutation instantly while the server request is in flight:
In React 19, functional components accept ref as a regular prop. The forwardRef wrapper is no longer needed (and will be deprecated in a future minor):
Server Actions work in both Server and Client Components. In a Client Component, import a Server Action and call it like a regular async function:
"use client";
import { deleteTask } from "@/app/actions";
function DeleteButton({ id }: { id: string }) {
return (
<button onClick={() => deleteTask(id)}>Delete</button>
);
}
The React Compiler (Formerly Forget)
The React Compiler - previously called React Forget - is in beta for React 19. It automatically memoizes components and values, eliminating the need for manual useMemo, useCallback, and memo() in most cases.
Practical deep-dives on LLMs, developer tools, and AI engineering. No filler. Unsubscribe any time.
// written byFIG. AUTH-01
530
Mahmudul Haque Qudrati
CEO & ML Engineer
CEO and ML Engineer at Pristren. Builds AI-powered software for teams and writes about machine learning, LLMs, developer tools, and practical AI applications.