Prerequisites to start with React:
Environment Setup for React:
There are multiple ways to starts with React, but in this article we are using Node.JS (npm).
Following are the steps to work with React:
- Download and install Node.JS(https://nodejs.org/en/download/)
- After installation, open node.js terminal
- Copy the following command and paste in terminal to install React packages for globally:
“npm install -g create-react-app”
Press Enter to run command.
- After installing the package go to your working directory and run the following command to create the React application:
The above screen shot you can see two parts in command. First part yellow color shows the ‘create-react-app’ command for creating React application and second part circle with blue color shows the ‘my-first-app’ here you can give your application name.
- Finishing the command the application is created in that directory. For running the application run following command:
Once you enter this above command you can see terminal like below screen shot:
- After “Compiled successfully!” window appears on the command prompt, one tab will be opened in web browser showing default React app page like following:
Great, our first React application is successfully created!
I hope that you understand the React with creating an example. If you have any suggestion regarding this article, then please comment below.
Thanks for reading. Learn it! Share it!