Skip to content
react questions

React · 6 of 13senior~1 min

What are React Server Components and how do they differ from Client Components?

#core#ssr#performance

React Server Components (RSC)

RSC are components that render exclusively on the server and send no JavaScript to the client.

Comparison

Server ComponentClient Component
RenderingServerClient + Server (hydration)
JS in bundleNoYes
Hooks (useState etc.)NoYes
Direct DB/FS accessYesNo
InteractivityNoYes

Example

tsx
// ServerComponent.tsx - no 'use client' async function ProductPage({ id }: { id: string }) { const product = await db.products.findById(id); // directly on the server return <ProductCard product={product} />; }

Key benefits

  • Less JavaScript in the bundle - faster load.
  • Data fetching close to the data source.
  • Sensitive data never reaches the client.

The 'use client' directive turns a component into a Client Component. In Next.js App Router all components are Server Components by default.

updated

did you know it?

read more on the blog

view all

related questions