1. Home
  2. Blog
  3. Next.js

Next.js

11 articles tagged Next.js by Darshan Panchasara.

Flat vector illustration of a long vertical list of data rows where an orange-red bookmark marker points directly at one row, beside a dark code panel, showing a cursor jumping straight to its place in the list
APIs, Backend & Security 15 min read

Cursor Pagination vs Offset Pagination: How to Page Through an API Properly

When to use cursor pagination or offset pagination in an API: why large offsets get slow, why pages repeat or skip items, keyset queries in SQL, opaque cursors, a Next.js route handler, response shapes, going backwards, and the mistakes I see most.

Flat vector illustration of a web dashboard loading with gray skeleton placeholder cards beside a spinner and a small code editor panel
CSS & Design 17 min read

Skeleton Screens vs Spinners vs Progress Bars: When to Use Each

How I choose between skeleton screens, spinners and progress bars: what each one is for, how long to wait before showing a loader, matching skeletons to the real layout to avoid layout shift, aria-busy and live regions, reduced motion, and skeletons with React Suspense and Next.js loading.js.

Flat vector illustration of a browser window swapping one page panel for another, with a keyboard focus ring in orange-red jumping from an old navigation link to the heading bar of the new page
React & Next.js 15 min read

SPA Focus Management: How to Fix Route Changes in React and Next.js

Client-side navigation in React and Next.js doesn’t reset focus or announce the new page. Here’s how SPA focus management works: focusing the h1 with tabIndex -1, what the Next.js route announcer does and doesn’t do, aria-live regions, skip links and testing with Playwright.

Flat vector illustration of a server-rendered page layout and a browser-rendered copy side by side, lined up like two puzzle halves, with one mismatched tile highlighted in orange-red where they fail to fit
React & Next.js 16 min read

React Hydration Error in Next.js: What Causes It and How to Fix Each One

A hydration error means the browser’s first render didn’t match the server HTML. Here’s what causes it in React and Next.js, from dates and typeof window to localStorage and bad HTML nesting, and the fix I use for each one.

Flat vector illustration of a browser window with a broken unstyled login page beside a dark code panel showing a matcher config, orange accent arrows routing requests around static assets
React & Next.js 12 min read

Next.js Middleware and Proxy: Auth Redirects, Rewrites, and Matchers Done Right

How I use Next.js Middleware (Proxy in Next.js 16) for auth redirects, safe return paths, rewrites, matchers, cookies and headers – without breaking CSS.

Flat vector illustration of a browser window with a small cache shelf of files, where an orange-red return arrow serves a repeat visit instantly from the browser cache instead of travelling to the origin server
Web Performance 19 min read

Cache-Control Headers in 2026: Caching Rules That Make Repeat Visits Instant

How I set Cache-Control headers on client sites: hashed assets cached for a year, HTML revalidated with ETags, private pages kept out of shared caches, and CDN rules that just work.

Flat vector illustration of a web page card whose hidden JSON-LD code panel links its article, breadcrumb and organization nodes into one connected graph, with the key node in orange-red
WordPress & SEO 18 min read

JSON-LD Structured Data in 2026: Schema Markup That Still Earns Rich Results

How I add JSON-LD structured data to client sites in 2026: the schema types that still earn rich results, one connected @graph, safe Next.js and WordPress output, and testing in CI.

Flat vector illustration of a browser window with a cursor hovering a link while the next page is already prerendered behind it, outlined in orange-red
Web Performance 20 min read

Speculation Rules API in 2026: Prerender the Next Page Before the Click

How I use the Speculation Rules API on client sites: prefetch vs prerender, document rules, eagerness levels, safe exclusions, prerender-aware analytics, and WordPress 6.8 speculative loading.

Flat vector illustration of a checkout request passing through an idempotency key gate so only one order is created despite repeated retries
APIs, Backend & Security 17 min read

Idempotency Keys in 2026: Stop Duplicate Payments and Double Submits in Your API

Learn how idempotency keys stop duplicate payments and double submits: the Idempotency-Key header, Postgres and Redis storage, 409 and 422 handling, safe retries, and webhook dedupe.

Abstract vector form submitting to a server action without a separate API route card, Next.js App Router mutation metaphor
React & Next.js 13 min read

React Server Actions in 2026: Forms and Mutations Without Extra API Routes

Practical Next.js Server Actions for client sites in 2026: progressive forms, useActionState, validation, auth cookies, revalidatePath/Tag, CSRF, and when to use Route Handlers instead.

Shield with a padlock blocking injected scripts while trusted page resources pass: Content Security Policy against XSS
APIs, Backend & Security 11 min read

Content Security Policy in 2026: Lock Down XSS Without Breaking Your Scripts

Practical CSP in 2026: report-only rollout, nonces vs hashes vs strict-dynamic, WordPress and Next.js headers, GTM, and a checklist to stop XSS without breaking scripts.

Up and down to move, Enter to go, Esc to close

Before you go

Planning a website launch?

Read the checks I run before any site goes live: speed, SEO, forms, accessibility and backups.

Read the launch checklist Ask on WhatsApp