Dev Helpers
← Back

First and last jump links

Place this file at components/FirstAndLastJumpLinks.tsx in an App Router project.

Open this example in the interactive library

Source code

// components/FirstAndLastJumpLinks.tsx

import Link from "next/link";

export default function FirstAndLastJumpLinks({
  page = 2,
  total = 5,
  base = "/articles",
}: { page?: number; total?: number; base?: string } = {}) {
  return (
    <nav>
      <Link href={base}>First page</Link> ·{" "}
      <Link href={{ pathname: base, query: { page: Math.max(1, total) } }}>
        Last page
      </Link>
    </nav>
  );
}