'How to implement dynamic routing in next js?
I have converted my React.js app to Next.js Now i wanted to route to my blog details page on click of card on blog page I am taking data from heroku api. In react i was doing it using react-router-dom How to do it in next.js ?
Solution 1:[1]
this page can help you to make your dynamic routing: Next Dynamic Routing
Inside pages folder:
File and Directory are self routes concepts:
pages/test.js works for localhost:3000/test
pages/test1/test.js works for localhost:3000/test1/test
Similarly:
pages/post/[pid].js works for localhost:3000/post/a OR localhost:3000/post/111 etc
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | tirth1620 |
