How To Install React in Windows or Mac OS.

How To Install React in Windows or Mac OS.

Install React in windows or Mac OS.

Pre-requisites:

  1. JavaScript Knowledge.
  2. HTML CSS Basics.
  3. Laptop (Windows/Mac).
  4. Internet Connection.

Installing React is very easy. Below are the given steps you can follow to install React in your system.

React versions:

React is a JavaScript library. Basically, use to develop Front-End. Latest version of React as per React documentation is 16.12.0.

Here in this article. I am going to install latest version of react.

Let’s Start…..

Before we start I would like to tell you that there are several ways of installing and using React in your project. But, here I am going to show you two ways to start with React development.

As per my experience the easiest way to use React is by using CDN also known as Content Delivery Network. However, it is only good for development and learning purpose. I would not recommend anyone to use CDN in production.

First Way

Step 1:

You can copy and paste CDN directly from React Official documentation or follow given link below.

https://reactjs.org/docs/cdn-links.html

CDN Links

Step 2:

Rendering an Element into the DOM

It displays “Hello, world” on the page.

Second Way

Another way is to use React is by installing it through NPM also known as node package manager.

For using NPM one need to have Node package installed in their system.Once you have installed Node package in your system you can follow below given steps.

Step 1:

You can use npm command to install React module as mentioned below.

npm install react

or you can use -g flag to install react module globally in your system.

npm install -g react 

Step 2:

You can use create-react-app packageto create React application in your system.

Here I’ll recommend you all to use NPX. However, you can use npm as well to start creating react application. The reason NPX will be useful because it will always helps you to start with the latest version.

If you’ve previously installed create-react-app globally via npm install -g create-react-app, we recommend you uninstall the package using npm uninstall -g create-react-app to ensure that npx always uses the latest version.

Step 3:

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

(npx comes with npm 5.2+ and higher, see instructions for older npm versions)

Then open http://localhost:3000/ to see your app.

When you’re ready to deploy to production, create a minified bundle with

npm run build.

Conclusion:

By following all the instructions and steps given above you can install and start with react development.

For more updates and tutorials on this topics or any other topic. You can write in the comment below.
Hope, this article would be helpful for you all. Any suggestions or improvement on this topic you can write in the comment below.

Share

2 thoughts on “How To Install React in Windows or Mac OS.

Leave a Reply

Your email address will not be published. Required fields are marked *