Setting up the create-react-app

In this lesson, we Install node and npm to set up a create-react-app project and have a look at a React class component

Installing node

If you are developing with JavaScript, there is no way around node and npm. You can find the installation instructions on the official website. Installing node will install npm (node package manager) as well. The node package manager is used to install libraries/frameworks (node packages) using the command line for your project whereas the ‘node’ command itself can be used to compile and run a JS file in a terminal, i.e.

$ node example.js

There exists an alternative to install and manage node: nvm. You should be able to install it via Homebrew for MacOS, and there exists a Windows version for nvm too. I highly recommend using nvm, because you can install and manage multiple node versions with it. Furthermore, it helps you to install your node version as well.

Starting a create-react-app Project

Follow the official create-react-app setup guide and read the file App.js which contains skeleton code for a React App. It should look something like the following.

Get hands-on with 1200+ tech skills courses.