Code Explainers

Code explainers tagged #cache-revalidation

javascript
'use server'
 
import { z } from 'zod'
import { revalidatePath } from 'next/cache'

Handling form submits with Next.js Server Actions

server-actions validation form-handling
Intermediate 7 steps
javascript
import { NextResponse } from 'next/server';
import { revalidatePath } from 'next/cache';
import crypto from 'node:crypto';
 

A GitHub webhook that revalidates Next.js docs

webhooks hmac-verification cache-revalidation
Intermediate 8 steps
javascript
'use server'
 
import { revalidatePath } from 'next/cache'
import { redirect } from 'next/navigation'

How a Next.js Server Action updates a post

server-actions authorization validation
Intermediate 7 steps