tatethurston / nextjs-routes

Type safe routing for Next.js
MIT License
553 stars 20 forks source link

Nextjs@13 not supported dynamic href in the /app directory #142

Closed po4tion closed 1 year ago

po4tion commented 1 year ago

First, If you are considering this, I am sorry for registering the issue.

When I run the examples/app folder(nextjs version is 13.3.0), I get the following error.

image

Link: Next.js Error Occurred

If you go to the link provided above, next.js says that url mapping is no longer available for the app directory structure.

[example code]

<Link href={{ pathname: "/[store]", query: { store: "tate" } }}>
  Tate's Store
</Link>

I think we need to figure out a way to use it in the app directory of Next.js@13.

If there's anything I made a mistake, please give me some advice!

tatethurston commented 1 year ago

Yes, the nextjs team removed support for the UrlObject form for Link with the app directory. Are you using the pages directory, the app directory, or both in your project?

po4tion commented 1 year ago

i'm using the app directory only.

tatethurston commented 1 year ago

Have you tried https://nextjs.org/blog/next-13-2#statically-typed-links? This library supports the pages directory, but nextjs now ships typescript support for the app directory

po4tion commented 1 year ago

Have you tried https://nextjs.org/blog/next-13-2#statically-typed-links? This library supports the pages directory, but nextjs now ships typescript support for the app directory

Thank you for your help. The "typed Routes" function works very well.