Thursday, April 13, 2017

How to install React



Guide for react installation can be found at : https://facebook.github.io/react/docs/installation.html

Steps involved
1) Create a project
npm init

2 ) Install React and React DOM
npm install --save react react-dom



3) Install Babel ( Enabling Es6 and JSX )
npm install --save-dev babel-cli babel-preset-react

 4) Babel preset 2015
npm install --save-dev babel-cli babel-preset-es2015

Enable babel
{
  "name": "reactprojects",
  "version": "1.0.0",
  "babel":{
    //my babel config file
  },

Install web pack
npm install --save-dev webpack

Create a React app.
Note:

  • We can download or clone the react-app using the following URL
           https://github.com/facebookincubator/create-react-app
  • Move to this folder in command prompt
c:\Development\ReactProjects\my-app\src>
  • Install all the necessary packages . Steps 1 to 4 described above
npm install -g create-react-app

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

Output

No comments:

Post a Comment