@devshahoriar

post cover
post cover

Defining Routes 2

Learn how to create your first route in Next.js2.

NextjsMdx2

Creating Routes

Route segments to path segments

A special page.js file is used to make route segments publicly accessible.

Defining Routes

In this example, the /dashboard/analytics URL path is not publicly accessible because it does not have a corresponding page.js file. This folder could be used to store components, stylesheets, images, or other colocated files.

Good to know: .js, .jsx, .ts, or .tsx file extensions can be used for special files.

Creating UI

Special file conventions are used to create UI for each route segment. The most common are pages to show UI unique to a route, and layouts to show UI that is shared across multiple routes.