Menu

Next.js: Server-side Rendering vs. Static Generation
📰
0

Next.js: Server-side Rendering vs. Static Generation

Vercel News·Lee Robinson·4 days ago
#PBXQx6y9
Reading 0:00
15s threshold

Next.js is a React framework that supports pre-rendering. Instead of having the browser render everything from scratch, Next.js can serve pre-rendered HTML in two different ways. With Server-side Rendering (SSR), Next.js pre-renders the page into HTML on the server on every request . TTFB (Time to first byte) is slower, but your data is always up-to-date. With Static Generation (SSG), Next.js pre-renders the page into HTML on the server ahead of each request, such as at build time. The HTML can be globally cached by a CDN and served instantly. Static Generation is more performant, but because pre-rendering happens ahead of time, the data could become stale at request time. Fortunately, there are ways to work around this issue without rebuilding the entire app when the data is updated. With Next.js, you can use Static Generation for maximum performance without sacrificing the benefits of Server-side Rendering.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.

Read More