How to: Use Create React App

In this tutorial, we will take a look at creating a new React site using create-react-app.

Overview

To create your React application, there is a tool I recommend using called Create React App. This, like the React library itself, is developed and maintained by Facebook. In this tutorial, I will show you how to create a new React site using create-react-app.

If you do not have NodeJS installed, make sure to download and install it; we will need this to use npm.

Once NodeJS is downloaded, you will need to install npx. To do this, you can run it by typing in

npm install -g npx

Once npx is installed successfully without any issues, navigate to the directory you would like to save your react project and enter these commands:

npx create-react-app my-app
cd my-app
npm start

You may automatically be redirected to http://localhost:3000, which means that the created React app is working properly. If it has not automatically taken you there, go ahead and point that URL in your browser. Sometimes this happens on Windows machines.

© 2019 - 2021 Brian McVeigh