Open this example in the interactive library
Source code
"use client";
// components/ExactActiveRouteLink.tsx
import Link from "next/link";
import { usePathname } from "next/navigation";
export default function ExactActiveRouteLink({
href = "/studio",
label = "Studio",
}: { href?: string; label?: string } = {}) {
const path = usePathname();
return (
<Link href={href} aria-current={path === href ? "page" : undefined}>
{label}
</Link>
);
}
