i am learning next-js .. before this project i used the dynamic id rendering .
but now this throws some error
Dynamic Id rendering not working in next js 13.4.6.
i can’t find the error .
is it because i dont have pages folder instead of app folder
Since you are using the app folder-based routing (which is new in NextJS 13) instead of the older page folder-based routing, so you have to create a dynamic folder name route. In your case it will be [user] and inside that you will have to add page.js file.
2
Answers
the page will be
user
not[userid]
and for
Dynamic Routes
Since you are using the
app
folder-based routing (which is new in NextJS 13) instead of the olderpage
folder-based routing, so you have to create a dynamic folder name route. In your case it will be[user]
and inside that you will have to addpage.js
file.So your directory structure will look like this:
Your main logic for the page will always reside in the
page.js
file. For more detailed understanding of this you can explore the NextJS documentation on server components routing or look at this Fireship video