Let's go ahead and create our basic application. If you had to set up a project purely by hand, you'd find yourself having to deal with many different tools, such as Babel for transpiling, ESLint for code checks, Jest for testing, or Webpack in order to pack all of your application together, instead of having to send dozens or hundreds of individual files over the web. However, nowadays, there is a much simpler tool, create-react-app, that can deal with this chore and get you set up for React development in a jiffy. The key selling point is zero configuration, meaning that some reasonable good choices for both development and production builds have been selected, and you can directly move on to writing code, not really caring about myriad configuration details.
To create the basic structure (which we'll explain later on) we'll use npx to run the application creator tool, as shown in the following code. Since we are at Chapter 6, let's (imaginatively!) name our project chapter06!
> npx create-react-app chapter06
Creating a new React app in /home/fkereki/JS_BOOK/modernjs/chapter06.
Installing packages. This might take a couple minutes.
Installing react-scripts...
...many lines describing installed packages, snipped out...
Success! Created chapter06 at /home/fkereki/JS_BOOK/modernjs/chapter06
Inside that directory, you can run several commands:
npm start
Starts the development server.
npm run build
Bundles the app into static files for production.
npm test
Starts the test runner.
npm run eject
Removes this tool and copies build dependencies, configuration files
and scripts into the app directory. If you do this, you can’t go back!
We suggest that you begin by typing:
cd chapter06
npm start
Happy hacking!