How To Create The First App In Next.js

Here, We learn how to create the Next Application.

To create an application in next.js we need to install any code editor and node.js.

Open the folder and open the command prompt.

And write below the command in cmd.

npx create-next-app first_nextapp

After creating the project we go into the project and open the application in the code editor.

cd first_nextapp
code .

Then our folder looks like this.

Now, open the index.js and change the code in that.

Our index.js looks like this.

import Head from 'next/head'
import styles from '../styles/Home.module.css'

export default function Home() {
  return (
    <div className={styles.container}>
      <Head>
        <title>Create Next App</title>
        <meta name="description" content="Generated by create next app" />
        <link rel="icon" href="/favicon.ico" />
      </Head>
      <main className={styles.main}>
        <h1 className={styles.title}>
          Welcome to <a href="https://nextjs.org">Next.js!</a>
        </h1>
      </main>
    </div>
  )
}

To run this application write the command in cmd.

npm run dev

Output:-

Submit a Comment

Your email address will not be published.

Subscribe

Select Categories