Chapter 8 of 21
Continue learning Next.js step by step.
Server Components
Understand Server Components in the Next.js App Router.
Theory
Server Components are components that can be rendered on the server.
They can help reduce the amount of JavaScript sent to the browser.
In the App Router, components are Server Components by default unless they are marked with "use client".
Example
export default function ServerComponent() {
return <h1>This is a Server Component</h1>;
}Output
The component is rendered as a Server Component.
Practice
Create a simple Server Component and display some content.
Interview Questions
1
What is a Server Component?
2
Are App Router components Server Components by default?
3
Why are Server Components useful?
Quick Quiz
Which option best describes this chapter?
A.Rendered on the server by default
B.Always rendered only in CSS
C.A database component
D.A browser API