Dev Helpers
← Back

Client collection siblings

Place this file at components/ClientCollectionSiblings.tsx in an App Router project. Mount inside a route with the named dynamic segments shown in useParams.

Open this example in the interactive library

Source code

"use client";

// components/ClientCollectionSiblings.tsx

import Link from "next/link";

import { useParams } from "next/navigation";

export default function ClientCollectionSiblings() {
  const { collection } = useParams<{ collection: string }>();
  return (
    <nav>
      <Link href={"/collections/" + encodeURIComponent(collection)}>Collection</Link> ·{" "}
      <Link href={"/collections/" + encodeURIComponent(collection) + "/about"}>
        About
      </Link>
    </nav>
  );
}