Functions
useRouter (App Router)
App Router client navigation hook from next/navigation. It exposes push, replace and history navigation among other methods. A refresh obtains a new server response but may reuse cached server data. Never forward untrusted destinations; prefer Link for ordinary navigation. Source: https://nextjs.org/docs/app/api-reference/functions/use-router. Documentation-reviewed illustrative draft; exact package and execution not verified.
Formal Syntax & Structure
nextjs syntaxnextjs
import { useRouter } from "next/navigation"Working Example
Example Snippetnextjs
const router = useRouter();// Inside a client event handler:router.push("/catalog");