Skip to main content

Routing in NextJS

NextJS support file based routing, every route has in the form folder that also had contains a file called page.tsx or page.jsx

  • In NextJS docs we use only App Router.

// default export component is render as a page

about-us
page.jsx

Let's create a NextJS Page

page.jsx
export default function Page() {
return (
<div>
<h1>This is a page</h1>
<main>Page Content</main>
</div>
)
}

Or

page.jsx
function Page() {
return (
<div>
<h1>This is a page</h1>
<main>Page Content</main>
</div>
)
}

export default Page;