Pooja
Pooja

Reputation: 613

How to create a dynamic route in Next.js

How can I create this type of url :

http://localhost:3000/designer/book1

http://localhost:3000/engeniring/book1

http://localhost:3000/art/book1

If I try to put files in specific name in pages folder, Then I have to do that multiple time.

Any idea?

Here desinger, enginerring, art are dynamic like book category and book1 are also dynamic is act like a single post

Upvotes: 0

Views: 278

Answers (1)

Ryan Le
Ryan Le

Reputation: 8412

You could set up the folder structure for nested dynamic routes

Something like this:

enter image description here

And then have your nesting routes inside.

Here is a live example for that

Upvotes: 1

Related Questions