Skip to content
Back to Blog
Deep Dive into React Server Components
Technology

Deep Dive into React Server Components

1 min read117

Deep Dive into React Server Components

Let's deeply understand how server components work.

Client vs Server Components

FeatureServer ComponentClient Component
Bundle SizeNot includedIncluded
DB AccessPossibleNot possible
StateNot possiblePossible

When to Use?

  • Server Components: Data fetching, sensitive information
  • Client Components: Interactions, event handlers
// Server component
async function ServerComponent() {
  const data = await db.query('SELECT * FROM posts')
  return <div>{data.map(post => <Post key={post.id} {...post} />)}</div>
}