Menu

How Rendering Works on the Web

Lesson 3: How Rendering Works on the Web

What is rendering?

Rendering is the process of turning components and data into HTML that a browser can display. The key question is where and when that happens.

  • Where: on the server or in the browser
  • When: at build time, at request time, or after the page loads

The main rendering strategies

Strategy

Where

When

Best for

Trade-off

Client-side rendering (CSR)BrowserAfter JavaScript loadsHighly interactive tools behind loginSlow first load, weak SEO
Server-side rendering (SSR)ServerOn every requestPersonalised or real-time pagesServer work on each visit
Static site generation (SSG)ServerAt build timeMarketing pages, docs, blogsContent can go out of date
Incremental static regeneration (ISR)ServerAt build time, then refreshed in the backgroundLarge catalogues that change occasionallyShort window of slightly old data
Partial prerendering (PPR)BothStatic shell at build, dynamic parts streamed per requestPages mixing shared and personal contentRequires Cache Components (Module 7)

Example

On LearnHub, different pages suit different strategies:

Page

Changes how often?

Personalised?

Good strategy

/aboutRarelyNoStatic
/courses/sqlWhen an instructor edits itNoStatic, refreshed on edit (ISR)
/search?q=pythonEvery queryNoDynamic (SSR)
/dashboardConstantlyYesStatic shell + dynamic parts (PPR)

How it works in Next.js

  1. Next.js renders on the server by default. Components are Server Components unless you say otherwise.
  2. If a route uses nothing request-specific, Next.js can prerender it at build time.
  3. If it reads cookies, headers, or search parameters, it renders at request time.
  4. Interactive parts are marked as Client Components and hydrate in the browser.
  5. You can mix strategies in one app, and even within one page.

You do not pick one strategy for the whole app. You pick per route, and often per component.

Common mistakes

  • Assuming "server" means slow. A prerendered page is served as a file and is often faster than CSR.
  • Making everything dynamic. Personal data on one card does not mean the whole page must render per request.
  • Confusing SSR with Server Components. SSR is about when HTML is produced. Server Components are about where component code runs. Module 3 explains the difference.

Key takeaways

  • Rendering strategy = where + when HTML is produced.
  • Static is fastest and cheapest; dynamic is freshest and most personal.
  • Next.js lets you choose per route and per component.

Try it: List five pages of a website you use. For each, decide whether it should be static, dynamic, or a mix, and write one reason.


Nextjs Tutorial

J

Jebasta





Get in Touch For Details