React 19: Server Components
React 19 introduces server components as a first-class feature, changing how we think about React applications.
Server Components
Server components run only on the server and send HTML to the client, reducing bundle size dramatically.
// This runs on the server only
async function BlogPosts() {
const posts = await db.posts.findMany();
return posts.map(post => <Post key={post.id} {...post} />);
}
The use() Hook
function Comments({ commentsPromise }) {
const comments = use(commentsPromise);
return comments.map(c => <Comment key={c.id} {...c} />);
}
React keeps getting better!