Performance: Async server components
Async server components improve page load speed by streaming content progressively and reducing blocking on the client.
export default async function Page() { const data = await fetchDataAsync(); return <div>{data.content}</div>; }
export default function Page() { const data = fetchDataSync(); return <div>{data.content}</div>; }
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Sync server component with blocking data fetch | Minimal DOM nodes initially | Single large reflow after full HTML arrives | High paint cost due to delayed content | [X] Bad |
| Async server component with streaming | DOM nodes streamed progressively | Multiple smaller reflows as content arrives | Lower paint cost with faster visible content | [OK] Good |
async server components in Next.js?async to use await inside.async function Greeting() {
const name = await Promise.resolve('Alice');
return <h1>Hello, {name}!</h1>;
}async function UserProfile() {
const user = fetch('/api/user');
return <div>{user.name}</div>;
}async function Dashboard() {
const user = await fetch('/api/user').then(res => res.json());
const posts = fetch('/api/posts').then(res => res.json());
return (
<div>
<h1>{user.name}</h1>
<ul>{posts.map(post => <li key={post.id}>{post.title}</li>)}Pass the test and this pattern moves unknown