dynamic route in next js #12260
-
hi and i have file [slug].js i need to know best way of writing slug to get dynamic pages |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
You need to set the So in your case something like <Link href="/[model]/[slug]" as={`/${props.model}/${props.slug}`}> should work as it now routes to |
Beta Was this translation helpful? Give feedback.
You need to set the
href
prop to the "real file" and use theas
prop to fill in the variables, see https://nextjs.org/docs/api-reference/next/link#dynamic-routesSo in your case something like
should work as it now routes to
[model]/[slug].js
file.