Let’s Create (a) React App
As I mentioned earlier, create-react-app
takes away much of the heavy work when starting a project, and we will be using it throughout this book. However, bear in mind that there are other ways to set up React; for instance, you can include it through a CDN just like plain old jQuery if you want to go old-school!
Let’s create a simple app that we will be building upon in this introduction. Grab a folder, mine is called chapter4
, cd
into it, and from your Terminal of choice type in the following:
npx create-react-app cars
Now watch the magic happen before your eyes! Npx is a tool that is included with the latest versions of npm, and it allows us to run executable scripts without the need to install them on your machine. Please allow the process to finish. This can take a while and the output might be cryptic, but eventually, we will have a properly initiated React project ready to be developed.
The Terminal will inform you that you...