Next.js
/Beginner
Navigation & Link Component
Definition
The methods used to navigate between routes in a Next.js application, primarily using the `<Link>` component and the `useRouter` hook.
Explain Like I'm New
Never use a standard HTML `<a href="/about">` tag in Next.js. It forces the browser to do a full, slow page reload. Use Next.js `<Link href="/about">` instead. It intercepts the click, fetches the new page in the background instantly, and feels like a native mobile app.
Real World Example
Building a Navbar where clicking 'Contact' instantly swaps the page content without the browser tab spinning.
Common Use Cases
- •Internal linking
- •Programmatic navigation
Interactive Example
Loading Code Playground...
Interview Questions
basic
- What component should you use for all internal navigation in Next.js?
intermediate
- What is 'Prefetching', and how does the `<Link>` component use it?