Technology
Understanding React Server Components
Published on February 1, 2024
What are Server Components?
React Server Components (RSCs) allow developers to write UI components that render entirely on the server. This can lead to significant performance improvements by reducing the amount of JavaScript sent to the client.
Benefits
- Zero Client-Side JavaScript: RSCs don't add to the client bundle size by default.
- Direct Backend Access: Securely access databases, internal services, or APIs directly from your component.
- Automatic Code Splitting: Only Client Components used by RSCs are loaded on the client.
- Improved Performance: Faster initial page loads and less client-side rendering work.
In Next.js App Router, components inside the app directory are Server Components by default. You opt into Client Components using the 'use client' directive.