← Next.js tutorial

Next.js

Linking Between Pages

Use Next.js's <Link> component instead of a plain <a> tag to navigate between pages within your own app.

Example: navigation with Link

import Link from "next/link";

export default function Nav() {
  return (
    <nav>
      <Link href="/">Home</Link>
      <Link href="/about">About</Link>
    </nav>
  );
}

A plain <a href="/about"> would work too, but it triggers a full page reload, throwing away everything already loaded and starting fresh. <Link> pre-fetches the destination page's content in the background as soon as it becomes visible, then swaps content in without a full reload when clicked, making navigation between pages of your own app feel close to instant. Reserve a plain <a> for links leaving your site entirely, for internal navigation within a Next.js app, <Link> is almost always the right choice.

Example
import Link from "next/link";

export default function Nav() {
  return (
    <nav>
      <Link href="/">Home</Link>
      <Link href="/about">About</Link>
    </nav>
  );
}
Output
Renders two navigation links; clicking either updates the page instantly without a full browser reload.
Ready to go further?

These free tutorials are a preview, our Frontend Development cohort covers it in depth, with a real project and a cohort alongside you. Closes Nov 30

Enroll in Frontend Development

Cookie preferences

Choose what you're comfortable with. You can change this any time from the footer.

Don't miss out

Ready to build something real?

Create a free account to enroll in a track, and get notified the moment a cohort opens.

Create free account