Install React in windows or Mac OS.
- HTML CSS Basics.
- Laptop (Windows/Mac).
- Internet Connection.
Installing React is very easy. Below are the given steps you can follow to install React in your system.
Here in this article. I am going to install latest version of react.
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.
You can copy and paste CDN directly from React Official documentation or follow given link below.
Rendering an Element into the DOM
It displays “Hello, world” on the page.
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.
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
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.
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.
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.