React Server Components (RSC)
RSC is a paradigm shift in how we build React applications. By moving logic to the server, we reduce the bundle size sent to the client.
Key Benefits
- Zero Bundle Size: Server components don't add to the JS bundle.
- Direct Database Access: Query your DB directly inside your component.
- Automatic Code Splitting: Next.js handles this out of the box.
async function BlogPost({ id }) {
const post = await db.post.findUnique({ where: { id } });
return <h1>{post.title}</h1>;
}