Deployment & Environment Variables in Next.js Quiz – 15 Questions with Answers
15 questions · 12 min · Medium
Test your knowledge of data fetching in Next.js with 15 questions covering Server-Side Rendering (SSR), Static Site Generation (SSG), Incremental Static Regeneration (ISR), caching, revalidation, and rendering strategies.
No sign-up needed · Last updated:
Score: 0 00:00
Create a free account to keep your scores and track your progress. It is optional.
15 questions · 12 min · Medium
15 questions · 12 min · Medium
20 questions · 15 min · Medium
15 questions · 12 min · Medium
15 questions · 12 min · Medium
15 questions · 12 min · Medium
B. Server-Side Rendering
SSR stands for Server-Side Rendering, where the server generates the HTML for a request rather than relying entirely on pre-generated static HTML.
A. Pages are generated at build time
With SSG, pages can be generated ahead of time during the build process and then served as static content.
B. Incremental Static Regeneration
ISR stands for Incremental Static Regeneration. It allows statically generated content to be updated or regenerated after the initial build.
A. SSR
SSR is appropriate when the HTML needs to be generated on the server based on request-time data.
B. SSG
SSG is well suited to content that does not need to be generated for every request and can be prepared ahead of time.
B. It allows static content to be updated without rebuilding the entire site for every content change
ISR combines static generation with revalidation, allowing selected content to be regenerated as it becomes stale.
A. next.revalidate
In the App Router, fetch can use the next.revalidate option, such as fetch(url, { next: { revalidate: 60 } }), to specify a revalidation period.
B. The cached data can be considered stale after approximately 60 seconds and may be revalidated
A revalidation interval specifies how long cached data can be considered fresh before Next.js can revalidate it.
B. cache: 'no-store'
Using cache: 'no-store' tells Next.js not to cache the result of that fetch, making it suitable for request-time data.
A. cache: 'force-cache'
cache: 'force-cache' requests that Next.js use a cached response when available and is commonly associated with static or cached data fetching.
A. revalidatePath
revalidatePath can be used to invalidate cached data for a specific route so that the route can be regenerated or refreshed with updated data.
A. revalidateTag
revalidateTag is used to invalidate cached data associated with a specified cache tag, allowing related data to be revalidated.
A. A product catalog that changes occasionally and should remain fast
ISR can be useful for content such as product catalogs where static performance is desirable but the content needs periodic updates.
A. SSR generally generates HTML at request time, while SSG generates pages ahead of time
SSR is based on request-time server rendering, while SSG produces static pages ahead of requests.
A. ISR can extend static generation by allowing generated content to be revalidated and updated
ISR builds on static generation by allowing selected static content to be regenerated or revalidated as data changes.