0%

Next.js Create a new page

Create a new post under the “pages” folder

A page in Next.js means a React Component exported from the file in pages folder.

So we can easily add a post under the pages folder. For better file management, creating a “posts” folder under the pages folder.

Then we can add the first post file “first-post.js” manually into the posts folder.

Type the following contents in the “first-post.js”

1
2
3
export default function FirstPost() {
return <h1>First Post</h1>
}

After saving the file, we can check the local wetsite using the post path http://localhost:3000/posts/first-post