We're going to be using the command line on your local machine to build your first React app. To do this, you're going to have to install Nodejs, and a few libraries, if you don't already have them.
First off, the perpetually-popular Nodejs!
Go to the package-manager install page for node.js, select your operating system, and follow the instructions to download and install Nodejs on your computer.
After you've done that, make sure that Nodejs is running on your system. Depending on what kind of machine you are using, you may need to open a new terminal window, or re-source your shell. You'll know you've got it working if you can type
at the prompt and get a list of commands and their descriptions! ✅
Yarn is a package manager for Nodejs. Were going to use it install create-react-app and get ourselves set up with a working React application.
Go to the installation page for the yarn project and select the tab for your operating system. Follow the instructions there to install Yarn on your machine.
Now that that's out of the way, we can get back to React. With Yarn installed, run
yarn global add create-react-app
from your command line.
To test that its working, run
and make sure that it shows you a list of commands and instructions for using them.
If you don't see the expected output, something went wrong somewhere along the way, and you may need to get help setting up your environment. If so, don't be afraid to ask for help!
Create a React app!
Once you have create-react-app installed and working, think of a name for your app and run
This should produce a long stream of output, beginning with a message like
Creating a new React app in...
and ending with a success message and instructions for serving your new React app.
You should see a list of files output. If you inspect your file system you should now see the contents of your brand new react app! In the next section we'll take a look at these generated files.
Ta-da, you're done with the install process!