Code Explainers
Next.js code explainers
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
javascript
import { notFound } from 'next/navigation'; const PER_PAGE = 24; const SORT_OPTIONS = ['relevance', 'price-asc', 'price-desc', 'newest'];
Parsing search params in a Next.js page
input-validation
query-params
pagination
Intermediate
10 steps
javascript
import { NextResponse } from 'next/server'; import Stripe from 'stripe'; import { headers } from 'next/headers';
Handling Stripe webhooks in Next.js
webhooks
signature verification
payment processing
Intermediate
7 steps