Closed KingMatrix1989 closed 1 month ago
@KingMatrix1989 could you provide the following context for me?
npx nextjs-routes
)?@KingMatrix1989 could you provide the following context for me?
- nextjs-routes version:
- Are you using the pages directory, app directory, or both?
- Are you using nextjs-routes via next.config.js or the CLI (
npx nextjs-routes
)?- nextjs version:
yarn add nextjs-routes
)next.config.mjs
@KingMatrix1989 Next.js' App Router doesn't accept dynamic hrefs: https://nextjs.org/docs/messages/app-dir-dynamic-href you need to use a path, so I'm confused about the ask here.
useRouter
from next/navigation
or next/router
? https://nextjs.org/docs/app/api-reference/functions/use-router.@KingMatrix1989 Next.js' App Router doesn't accept dynamic hrefs: https://nextjs.org/docs/messages/app-dir-dynamic-href you need to use a path, so I'm confused about the ask here.
- Could you show me an example of a Link you expect to be able to write but cannot?
- Was this working previously for you with nextjs-routes?
- Are you using
useRouter
fromnext/navigation
ornext/router
? https://nextjs.org/docs/app/api-reference/functions/use-router.
Yeah, you are right. You said it in the README and I didn't notice :)
v2.2.2-rc.4 is the latest version with app router support. I'll cut a non pre-release version of 2.2.2 here in the next week or two.
I am using the latest version of the package and seems the Next Link component doesn't accept any dynamic route as
href
while I don't have the same issue withuseRouter
.Here are the generated types:
According to the above code, the
href
type can be onlyStaticRoute
orRouteLiteral
!!! Why did you ignore dynamic routes?