Link component 가 href 보다 더 함
가 client-side transition 처리, 목적 route prefetch, layout state 보존. In-app navigation 어디든 써. 평범한 는 full reload trigger.
Programmatic navigation
Client Component 안에서 next/navigation 의 useRouter() 가 코드로 navigate 할 수 있게. Server Component 는 redirect() 가능.
실제 쓰는 hook
| Hook | 반환 | 위치 |
|---|---|---|
useRouter() | Router method (push, replace, refresh) | Client |
usePathname() | 현재 pathname string | Client |
useSearchParams() | URLSearchParams | Client |
useSelectedLayoutSegment() | 현재 layout 의 active child segment | Client |