The Link component does more than href
<Link> performs client-side transitions, prefetches the destination route, and preserves layout state. Use it for any in-app navigation. Plain tags trigger full reloads.
Programmatic navigation
Inside Client Components, useRouter() from next/navigation lets you navigate from code. Server Components can call redirect().
The hooks you actually use
| Hook | Returns | Where |
|---|---|---|
useRouter() | Router methods (push, replace, refresh) | Client |
usePathname() | Current pathname string | Client |
useSearchParams() | URLSearchParams | Client |
useSelectedLayoutSegment() | Active child segment of the current layout | Client |