Creating your First React App


In this post we will learn How to Setup a React Environment and How to Create a Hello World App in React

What is React?

React is a JavaScript Library created by Facebook for building User Interfaces. Using React you can create reusable UI components.

How Does React Works?

React creates Virtual DOM in memory, where all the manipulations are done before making any changes to the Browser DOM. Whenever any changes happens in data, React updates the Virtual DOM and only the changed portion is updated in Browser's DOM

Setting up a React Environment

  1. Install Node.js if not already installed.
  2. Open Node.js terminal

  3. Install create-react-app package using NPM by running following command in terminal.
    npm install -g create-react-app
  4. Create Application by running following command in terminal
    npx create-react-app myfirstreact

  5. Run Application by running following command in terminal. Make sure your are navigated to the directory where application is installed.
    npm start
  6. A new browser window will pop up after running above command.
  7. To modify the html, Open the App.js file and replace with following contents and save. On Save the changes will be visible immediately on the browser. You don't have to reload the browser.

Comments

Popular Posts