React / Next.js

React Server Components

RSC architecture, server vs client components, serialization, streaming, Suspense boundaries

26 interview questionsยท
Senior
1

What is a React Server Component?

Answer

Server Components are React components that execute only on the server and are never sent to the client. Unlike traditional components, they don't need to be hydrated on the client side, which significantly reduces the JavaScript bundle size. They allow direct access to backend resources (databases, file systems) without exposing secrets or API keys.

2

How to declare a Client Component in React?

Answer

The 'use client' directive placed at the top of a file indicates that the component and all its imported children are Client Components. This directive marks the boundary between server and client code. Without this directive, components are Server Components by default in frameworks that support RSC like Next.js App Router.

3

What is the main difference between Server and Client Components?

Answer

Server Components execute on the server and their code is never sent to the client, while Client Components are sent to the browser and require JavaScript for interactivity. This fundamental distinction affects resource access, bundle size, and interactivity capabilities. Server Components cannot use React hooks or handle user events.

4

Which React hook can be used in a Server Component?

5

How to perform data fetching in a Server Component?

+23 interview questions

Master React / Next.js for your next interview

Access all questions, flashcards, technical tests, code review exercises and interview simulators.

Start for free