Nijaz
Nijaz

Reputation: 198

Dynamic routing in Next.js doesn't work (404 error)

I've just started with Next.js and I've already faced a problem with dynamic routing. For some reason it doesn't work although it should. I tried with folder and with file as well but it won't work. This is really cumbersome... enter image description here

It just displays 404 error...

Upvotes: 5

Views: 14609

Answers (2)

user23175504
user23175504

Reputation: 11

try to rename your index.js to page.js

Upvotes: 1

ivanatias
ivanatias

Reputation: 4033

In order for your dynamic routes to work and if you're using SSG, you need to make use of getStaticPaths and getStaticProps functions to pre-render all the paths (and the content for each one as well) containing the meetupId param.

You can read more here

Upvotes: 5

Related Questions