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>
);
}
