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
- Install Node.js if not already installed.
- Open Node.js terminal
- Install create-react-app package using NPM by running following command in terminal.
npm install -g create-react-app
- Create Application by running following command in terminal
npx create-react-app myfirstreact
- Run Application by running following command in terminal. Make sure your are navigated to the directory where application is installed.
npm start
- A new browser window will pop up after running above command.
- 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
Post a Comment