Routing in nextjs
Briefly

In Next.js, properly organizing your files and folders is crucial for defining routes. Each route requires a corresponding folder, and within that folder, a file named 'page.tsx' that reflects the content of that route. For instance, if you have a 'contact' folder with 'page.tsx', you should create another folder named 'website-design' alongside it and move the file 'website-design.tsx' into this new folder, renaming it to 'page.tsx'. This structure will ensure that both routes are set up correctly for navigation.
To define routes in Next.js, create a folder structure where each folder corresponds to a route, with an accompanying 'page.tsx' file defining the content for that route.
When organizing the files, it is essential to place each page in its respective folder. For instance, both 'contact' and 'website-design' should each have their own 'page.tsx'.
Following the structure, the final directories should look like this: 'app\contact\page.tsx' and 'app\website-design\page.tsx', ensuring correct routing.
Renaming 'website-design.tsx' to 'page.tsx' and moving it into its designated folder is critical for the page to be accessible as intended in the app's structure.
Read at www.sitepoint.com
[
|
]