Skip to content
Discussion options

You must be logged in to vote

In Next.js App Router, for dynamic pages like news/[slug], you fetch data using fetch in your Server Components.

  1. Time-based ISR (revalidate in fetch):
    Add revalidate: 3600 (1 hour) to your fetch call. Next.js serves the old page instantly, then fetches new data in the background. Pros: Simple. Cons: Content can be stale for up to an hour.

  2. On-Demand Revalidation (revalidateTag):
    This is your best friend for freshness. Tag your fetch call: { next: { tags: ['article-id-123'] } }. When your article is updated in your CMS, tell your backend to hit a special Next.js API route (a Route Handler) that calls revalidateTag('article-id-123'). Pros: Near-instant updates, atomic (full page replaced…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by SoumyaEXE
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants