A Look at React 19 New Features
Introduction
React 19 is finally stable, bringing Actions, useOptimistic, useFormStatus, and a series of new APIs. These updates fundamentally change how we write async interactions.
Actions
Actions are React 19's most important concept. Simply put, you can pass an async function to <form action={...}>, and React will automatically manage pending state, error handling, and optimistic updates.
function UpdateName() {
const [name, setName] = useState("");
const [error, setError] = useState(null);
const [isPending, startTransition] = useTransition();
const handleSubmit = () => {
startTransition(async () => {
const error = await updateName(name);
if (error) {
setError(error);
return;
}
redirect("/path");
});
};
return (
<div>
<input value={name} onChange={(e) => setName(e.target.value)} />
<button onClick={handleSubmit} disabled={isPending}>
Update
</button>
{error && <p>{error}</p>}
</div>
);
}
useOptimistic
useOptimistic lets you optimistically update the UI before the request completes, automatically rolling back on failure. Useful for high-frequency interactions like likes and comments.
Summary
React 19's core idea: sink async interaction state management into the framework layer. Developers only care about business logic; pending/error/optimistic are handled by React.