Next.js 16 · Routing and files
Return a 404
Call notFound() in a server component to render the closest not-found page.
import { notFound } from "next/navigation";
if (!post) notFound();
Official Next.js 16 documentation
Next.js 16 · Routing and files
Call notFound() in a server component to render the closest not-found page.
import { notFound } from "next/navigation";
if (!post) notFound();
Official Next.js 16 documentation
Was this page helpful?