diff --git a/client/components/Link.tsx b/client/components/Link.tsx index 836df881..6bb16a77 100644 --- a/client/components/Link.tsx +++ b/client/components/Link.tsx @@ -3,8 +3,9 @@ import { useRouter } from "next/router"; const Link = (props: LinkProps) => { const { basePath } = useRouter(); - const href = basePath ? `/${basePath}/${props.href}` : props.href; + const propHrefWithoutLeadingSlash = props.href ? props.href.replace(/^\//, "") : props.href; + const href = basePath ? `/${basePath}/${propHrefWithoutLeadingSlash}` : props.href; return } -export default Link \ No newline at end of file +export default Link