Creating and setting up your own React project from scratch can be, at times, a little bit tricky. That's why we have create-react-app, a command that prepares and installs all the boilerplate for us and has our application ready to rock from the very first moment after the process finishes. If you are creating a React app for the first time follow the given steps :
Step 1: Creating the folder that will host our project
We're going to start by creating a new directory for our project at a location of our choice.
Now we will move inside the folder that we just created.
Step 2: Initializing the project
For initializing our project, we're going to run a npm command.
npm(Node Package Manager)is a package, version and dependencies manager made for JavaScript. If you haven't installed npm yet, firstly you need to directly install Node.js.You can also check the version of your npm using the command:
Now run the following command to make an empty React App:
Installing of all the dependencies will take a few minutes and after that these commands will appear
Step 3: Installing dependencies
We also need to install a few dependencies manually.
React dependencies
We'll be installing the following dependencies on React's side:
react : the JavaScript library that we'll be working on.
react-dom : package with some methods to manage DOM elements.
react-router-dom : package that contains the DOM bindings for React Router.
The use of these dependencies will be discussed in further lessons.