Functions

notFound

Terminates rendering of the route segment using framework control flow. Does not return normally; avoid swallowing its thrown error. Source: https://nextjs.org/docs/app/api-reference/functions/not-found. Draft; examples are illustrative snippets, not complete runnable programs.

Formal Syntax & Structure

nextjs syntaxnextjs
import { notFound } from "next/navigation"

Working Example

Example Snippetnextjs
if (!book) notFound();
Next.js Reference