Creating and running a React app
Now that we have Node.js and the code editor installed, we are ready to create our first React.js app. We are using Facebook's create-react-app
(https://github.com/facebook/create-react-app) kit for this. Here are the steps you need to follow in order to make your first app:
- Open PowerShell or a terminal that you use and type the following command:
npx create-react-app myapp
This command creates a React app named myapp
. The npm package runner is npx
and, when you're using it, you don't have to install the package before running it:
- Once the app has been created, move it into your app folder:
cd myapp
- Then, we can run the app with the following command. This command runs the app in the
3000
localhost port and opens the app in a browser:
npm start
- Now, your app is running, and you should see the following page in your browser...