0
0
NextJSframework~10 mins

Why server components are the default in NextJS - Visual Breakdown

Choose your learning style9 modes available
Concept Flow - Why server components are the default
User requests page
Server renders components
Server Components fetch data
Server sends HTML to browser
Browser displays page
Client Components hydrate if needed
User interacts with page
The server handles rendering first, fetching data and building HTML, then sends it to the browser where client components activate if needed.
Execution Sample
NextJS
export default async function Page() {
  const data = await fetchDataFromServer();
  return <div>{data.message}</div>;
}
A server component fetches data and returns HTML to display on the page.
Execution Table
StepActionComponent TypeData FetchOutput SentBrowser Action
1User requests pageN/AN/AN/AN/A
2Server starts renderingServer ComponentFetch data from serverNo output yetN/A
3Server completes renderingServer ComponentData fetched<div>Hello</div>N/A
4Server sends HTMLN/AN/AHTML sent to browserBrowser receives HTML
5Browser displays HTMLN/AN/AHTML rendered visuallyPage visible to user
6Client Components hydrateClient ComponentN/AN/AAdds interactivity
7User interactsClient ComponentN/AN/AResponds to user input
8EndN/AN/AN/APage fully loaded and interactive
💡 Rendering ends after server sends HTML and client hydrates interactive parts
Variable Tracker
VariableStartAfter Step 2After Step 3After Step 4Final
dataundefined{ message: 'Hello' }{ message: 'Hello' }{ message: 'Hello' }{ message: 'Hello' }
HTMLemptyempty<div>Hello</div><div>Hello</div><div>Hello</div>
Browser StateemptyemptyemptyemptyRendered and hydrated
Key Moments - 2 Insights
Why does the server fetch data before sending HTML?
Because server components run on the server, they can get data first and send ready HTML, as shown in steps 2 and 3 of the execution table.
What happens if a component needs interactivity?
Client components hydrate after the HTML arrives in the browser (step 6), adding interactivity without reloading the whole page.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution table, at which step does the server send the HTML to the browser?
AStep 4
BStep 2
CStep 6
DStep 1
💡 Hint
Check the 'Output Sent' column in the execution table.
According to the variable tracker, what is the value of 'data' after step 3?
Aundefined
Bempty
C{ message: 'Hello' }
Dnull
💡 Hint
Look at the 'data' row and the 'After Step 3' column in variable_tracker.
If the component was only client-side, which step would be missing from the execution table?
AStep 6 (Client Components hydrate)
BStep 2 (Server starts rendering)
CStep 4 (Server sends HTML)
DStep 5 (Browser displays HTML)
💡 Hint
Server rendering steps involve server components, check steps 2 and 3.
Concept Snapshot
Server Components run on the server by default.
They fetch data and render HTML before sending to the browser.
This reduces JavaScript sent to the client.
Client Components hydrate after HTML loads for interactivity.
This improves performance and user experience.
Full Transcript
When a user requests a page, the server renders server components first. These components fetch data directly on the server and build the HTML. The server then sends this HTML to the browser, which displays the page quickly. If parts of the page need interactivity, client components hydrate after the HTML loads, adding event handlers and dynamic behavior. This approach makes server components the default in Next.js because it improves speed and reduces the amount of JavaScript sent to the browser.