Knowledgebase

Rendering and Data Loading in Next.js Print

  • frontenddevelopment, frontend, caching, guide, howto, solution, zillionkinghost, hosting
  • 0

Where work happens.

WHAT OPTIONS EXIST

Static generation at build time Server rendering per request Incremental regeneration Client-side fetching

WHAT TO CHOOSE FOR CONTENT THAT RARELY CHANGES

Static generation.

WHAT TO CHOOSE FOR PERSONALISED CONTENT

Server rendering.

WHAT TO CHOOSE FOR CONTENT CHANGING OCCASIONALLY AT SCALE

Incremental regeneration.

WHAT TO AVOID

Client fetching for content that should be present in the initial response.

WHY

It delays visible content and complicates indexing.

WHAT TO BE CAREFUL WITH

Data fetched on every request where it could be cached Fetching the same data in several components Secrets used in code that also runs in the browser

THAT LAST POINT

Establish clearly which code runs where.

WHAT TO USE FOR MUTATIONS

The framework's server-side action facilities, where available.

WHAT TO VALIDATE

Every input, on the server, regardless of client validation.

WHAT TO CACHE

Aggressively, with deliberate invalidation.

WHAT TO TEST

What the initial response actually contains.

HOW

View the page source, not the inspected document.


Was this answer helpful?
Back

Are you happy with your experience? Leave us a review on Trustpilot.


Trustpilot