Next.js Discord

Discord Forum

Dynamic routes somewhy does not work. The code is from next.js docs.

Unanswered
Saltwater Crocodile posted this in #help-forum
Open in Discord
Original message was deleted.

8 Replies

Original message was deleted
Try to read the error log for the router error
you are probabbly mixing up the documentation from the pages dir.
you are using the app folder hence you need to switch the documentation to the app router
Saltwater Crocodile
if ill do this in pages folder it should work?
Saltwater Crocodile
well it doesnt D:
thats unfortunate :(
just use the app router documentation, you'll have better chance at making it work
https://nextjs.org/docs/app
Original message was deleted
You need to import useRouter from next/navigation

But it seems usePathname or useSearchParams are more suitable for this