Skip to content
Learn Netverks

Lesson

Step 10/36 28% through track

navigation-links

Navigation and Link

Last reviewed May 28, 2026 Content v20260528
Track mode
client_nextjs
Means
In-browser Next.js (client components)
Reading
~2 min
Level
beginner

This lesson

This lesson teaches Navigation and Link: the concepts, APIs, and habits you need before advancing in Next.js.

Without Navigation and Link, you will struggle to read or extend Next.js codebases and playground exercises.

You will apply Navigation and Link in contexts like: Marketing sites, dashboards, e-commerce, and Vercel-style deployments that need hybrid static + dynamic pages.

Write TSX for Client Components, click Run—React 18 CDN + in-browser TSX compile; use client/server lessons explain App Router concepts; mountApp renders interactive UI; printOutput feeds the terminal.

When you can explain the previous lesson's ideas without copying starter code.

Client-side navigation in Next.js uses the Link component from next/link and the useRouter hook from next/navigation (App Router). Links prefetch routes in the viewport for snappy transitions.

Link basics

import Link from 'next/link';

<Link href="/about">About</Link>
<Link href="/blog/hello">Hello post</Link>

Prefer Link over raw <a> for internal routes—it avoids full page reloads and enables prefetching.

Programmatic navigation

'use client';
import { useRouter } from 'next/navigation';

function LogoutButton() {
  const router = useRouter();
  return <button onClick={() => router.push('/login')}>Log out</button>;
}

Playground note

Below we simulate client navigation with React state—the same UX pattern Link provides in a real app. In projects, import Link and useRouter from Next.js packages.

Self-check

  1. Why use Link instead of <a href> for internal routes?
  2. Which hook replaces the old Pages Router useRouter from next/router?

Challenge

Mini nav

  1. Click each nav button and confirm the active page label updates.
  2. Add a third route label to the array and a matching button.

Done when: three routes switch content without a full reload pattern (state-driven).

Challenge

Third route

  1. Add a Contact route to the nav array and button.
  2. Confirm active styling follows the new path.

Done when: three nav buttons switch the active route label.

Interview tip Lesson completion confidence

Can you explain this lesson in 30 seconds without reading notes?

Not saved yet.

Playground

Runs in your browser in a sandboxed frame. Backend runners appear when this track’s profile allows them.

Check yourself

Multiple choice — immediate feedback.

Discussion

Past discussion is visible to everyone. Only logged-in users can post comments and replies.

Starter discussion topics

  • Link vs anchor tag?
  • Prefetch trade-off?

Sign up or log in to post comments and sync lesson progress across devices.

No discussion yet. Be the first to ask a question.

Jump