DEV Community

Butonix
Butonix

Posted on • Edited on

How to use dynamic router in Next.js?

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?

Top comments (0)