Dev Helpers
← Back

Route-specific support link

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

Open this example in the interactive library

Source code

"use client";

// components/RouteSpecificSupportLink.tsx

import Link from "next/link";

import { usePathname } from "next/navigation";

export default function RouteSpecificSupportLink({
  href = "/studio",
  label = "Studio",
}: { href?: string; label?: string } = {}) {
  const path = usePathname();
  return (
    <Link href={{ pathname: "/support", query: { from: path } }}>
      Help with {label}
    </Link>
  );
}