DEV Community


How to use dynamic router in Next.js?

butonix profile image Butonix Updated on ・1 min read

Before that, I used the next-routes library and prescribed routes like this:

const routes = require('next-routes')
module.exports = routes()
.add({ name: 'article_detail', pattern: '/:categoty_name/:article_slug', page: 'article_detail' })

Now the developers are Next.js is said to support dynamic routes by default

Question. How to use new routes with transition. That is, if I had a category/link to an article, how do I now specify this in the pages folder?
They offer the /post/first-post option
In other words, create a post folder and then the file [..slug]
What should I do in my version?

Discussion (0)

Editor guide