Next.js Discord

Discord Forum

How to handle params route

West African Crocodile posted this in #help-forum
Open in Discord
West African CrocodileOP
Hi all,
How can I create route based on params like this :
/ -> index
/[username] -> username ?
Can I create two page.tsx and [username].tsx or I have to create only one page and check if there is no username for rendering index ?
In the past I used the pages folder and I know that we can do this but I don't find how with the app folder

2 Replies

For creating dynamic routes, you should create a directory containing brackets and params inside the brackets, like this: