Functions

usePathname

Client hook reading the current pathname without query string. Hybrid routers and rewrites need separate review. Source: https://nextjs.org/docs/app/api-reference/functions/use-pathname. Draft; examples are illustrative snippets, not complete runnable programs.

Formal Syntax & Structure

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

Working Example

Example Snippetnextjs
const pathname = usePathname();
Next.js Reference