Today we are going to learn how to create a React project with Next.js and run it.
The first thing we are going to do is to create a new project with this command:
npx create-next-app my_app
Now it will ask about the configuration.
I have chosen and recommend this one:
Use TypeScript since it allows us to use typing in JavaScript, it will solve and speed up development. We will use ESLint to improve and control the generated code, it’s important to install the VSCode ESLint plugin.
We use regular CSS, create the src directory, and it creates an example App Router for us. Also, we are not going to use aliases.
Now we must wait while it generates the project.
We verify that it creates the project inside the folder we have indicated.
The important commands will be:
- Install new libraries:
npm install <plugin_name> --save
- Run the web in development:
npm run dev
- Generate production build (web to launch with Apacheor Nginx)
npm build
- Install libraries that are not in node_modules:
npm run