Skip to content

Latest commit

 

History

History
36 lines (25 loc) · 689 Bytes

app-dir-dynamic-href.md

File metadata and controls

36 lines (25 loc) · 689 Bytes

Dynamic href is not supported in the /app directory

Why This Error Occurred

You have tried to use a dynamic href with next/link in the app directory. This is not supported as the new client-side router no longer uses a mapping of dynamic routes -> url, instead it always leverages the url.

Possible Ways to Fix It

Before

<Link
  href={{
    pathname: '/route/[slug]',
    query: { slug: '1' },
  }}
>
  link
</Link>

Or

<Link href="/route/[slug]?slug=1">link</Link>

After

<Link href="/route/1">link</Link>

Useful Links

next/link documentation