Client navigation and history
Client navigation changes the active route without loading an entirely new document for ordinary internal transitions. The App Router exposes useRouter for navigation after a client-side event. Prefer Link for ordinary destinations and use imperative navigation for a genuine action flow.
Scope: Next.js 16.x candidate, App Router only, Cache Components disabled, TypeScript unless otherwise labeled. Examples are static source walkthroughs; exact framework patch and build are not verified.
app/catalog/ContinueButton.tsx
'use client';import { useRouter } from 'next/navigation';export default function ContinueButton() { const router = useRouter(); return <button type="button" onClick={() => router.push('/catalog/harbor')}> Continue to next recommendation </button>;}When pressed in the catalog UI, the button requests navigation to /catalog/harbor and normally adds a browser history entry. Render this component inside a page to use it. A regular link is simpler if no action is needed.
Push versus replace
Push adds a history entry; replace substitutes the current entry. Imagine the current history is /, then /catalog. A push to /catalog/moss gives three entries, so Back returns to /catalog. A replace gives /, then /catalog/moss, so Back returns to /. These are simplified histories without additional browser entries or redirects. Direct entry or reload starts a document load. Navigating between different root layouts also causes a full page load in the documented App Router. Do not infer server behavior from soft navigation within a single root layout.
Replace an obsolete filter URL (partial JSX)
<Link href="/catalog?sort=title" replace> Use title order instead</Link>The link uses replacement history behavior rather than adding an entry. Use it only when retaining the old URL is not useful.
Common mistake
In App Router use next/navigation, not next/router. Never pass an arbitrary user-supplied URL to push or replace: choose a known internal path or validate it against an allowlist.
Try it yourself
Write the history sequence for / → /help → push /catalog → replace /catalog/moss → Back. Then test the same sequence in a real browser when a reviewed project is available.
After this lesson, you should be able to: Predict back and replace behavior; Distinguish direct load from soft navigation.