Dev Helpers
← Back

Comparison route shortcut

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

Open this example in the interactive library

Source code

// components/ComparisonRouteShortcut.tsx

import Link from "next/link";

export default function ComparisonRouteShortcut({
  slug = "desk-lamp",
  name = "Desk lamp",
}: { slug?: string; name?: string } = {}) {
  return (
    <Link href={{ pathname: "/compare", query: { item: slug } }}>Compare {name}</Link>
  );
}