Start
Manual Setup
Create the react app
npm install next react react-dom
Add nextjs packages
- Open
package.json
and add the followingscripts
:
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
}
Add gitignore
touch .gitignore
- Paste the following in it
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies
/node_modules
/.pnp
.pnp.js
# testing
/coverage
# next.js
/.next/
/out/
# production
/build
# misc
.DS_Store
*.pem
# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# local env files
.env.*
# vercel
.vercel
.*
Create the pages folder
mkdir pages && touch pages/_app.js
- This has to be copied in the
_app.js
file - You can update this file to add styles components
export default function MyApp({ Component, pageProps }) {
return (
<>
<Component {...pageProps} />
</>
);
}
- Home page
touch pages/index.js
import React from "react";
export default function Home() {
return <div>This is the home page</div>;
}
Add components folder
mkdir components && touch components/index.js
export * from "./QuizResult";