React 19 is a game-changer.
It brings powerful new features that make building apps faster, cleaner, and more intuitive than ever. In this post, we’ll break down the most important updates so you can start using them right away.
What’s new?
You can now use the action
attribute on <form>
, <input>
, and <button>
to submit data via React Actions no more onSubmit
boilerplate.
Nice-to-have?
Yes. Use useActionState
to manage form state (like loading or errors) easily.
import { useActionState } from 'react';
export function Signup() {
const [state, formAction, pending] = useActionState(createUser, { message: '' });
return (
<form action={formAction}>
{/* ... */}
<button disabled={pending}>
{pending ? 'Submitting...' : 'Submit'}
</button>
{state.message && <p>{state.message}</p>}
</form>
);
}
Show updates immediately before the server confirms thanks to useOptimistic
const [optimisticTodo, setOptimisticTodo] = useOptimistic(currentTodoList);
const handleAdd = async (formData) => {
const newTask = {
id: Date.now(),
title: formData.get('task'),
completed: false,
};
// Show it instantly
setOptimisticTodo([...optimisticTodo, newTask]);
// Save to server
const savedTask = await addTodoToServer(newTask);
updateTodoList(savedTask);
};
The use API in React 19 isn’t a traditional hook—it’s an API that you can use inside components or other hooks, and unlike other hooks, it can be called conditionally or inside loops and branches.
if (showTheme) {
const theme = use(ThemeContext);
return <div className={`theme-${theme}`}>…</div>;
}
This is especially useful when you want to conditionally read context without wrapping everything in useContext
.
<Suspense>
component<Suspense fallback={<p>Loading...</p>}>
<ClientComponent dataPromise={promise} />
</Suspense>
function ClientComponent({ dataPromise }) {
const data = use(dataPromise);
return <div>{data}</div>;
}
Server Components (RSCs):
React 19 makes Server Components the default meaning components automatically render on the server unless otherwise specified.
Why it matters:
You can fetch data directly in your component using async/await
—no useEffect
or useState
needed.
The server sends only the final HTML to the client—no extra JavaScript, which means smaller bundles and faster load times.
This boosts SEO because crawlers immediately receive content-heavy HTML.
Server Actions:
Server Actions let client components trigger server-side logic directly, without the need to build separate API endpoints—and all harnessed by a simple directive: "use server"
.
Why it matters:
Eliminates boilerplate: no need to set up REST endpoints or handlers—React handles it under the hood.
Keeps server logic on the server, reducing unnecessary client code.
// actions.server.js
'use server';
export async function submitContactForm(formData) {
const name = formData.get("name");
const message = formData.get("message");
// E.g., save to database...
return { success: true, message: "Sent successfully!" };
}
// ContactForm.client.jsx
'use client';
import { submitContactForm } from "./actions.server";
export default function ContactForm() {
return (
<form action={submitContactForm}>
<input name="name" placeholder="Name" />
<textarea name="message" placeholder="Your message…" />
<button type="submit">Send</button>
</form>
);
}
ref
as a prop: Pass refs directly to function components—no more forwardRef()
.
Cleanup on unmount: Refs can now return a cleanup callback when components unmount.
Context usage simplified: Instead of <MyContext.Provider>
, you can write <MyContext>
directly.
You no longer need external libs like react-helmet
. React 19 lets you manage <title>
, <meta>
, and <link>
tags right in your components and hoists them to <head>
automatically.
Less duplicate error logs.
Better hydration error messages for easier debugging.
React 19 brings fresh ways to simplify form handling, async logic, metadata, animations, and error management all while improving performance and developer ergonomics.
Explore our collection of high-performance, beautifully designed React & Next.js templates all updated to support React 19 features.
Learn how to build Laravel apps that scale without chaos. Practical tips on structure, clarity, and maintainability for long term success.
Add smooth micro-interactions to your website without slowing it down. Learn lightweight, user-friendly animation tips for better UX and speed.
Learn how to easily host your Next.js website on Vercel with this step-by-step beginner’s guide. Get your site live in minutes no dev experience required!
Tailwind CSS helps us create modern, flexible templates. Here’s why we trust it and why it’s a smart choice for your next website.
No Spam. Only high quality content and updates of our products.
Join 20,000+ other creators in our community