React js basics 1.0 :

by Ahin Subhra Das

React is a free and open-source front-end JavaScript library for building user interfaces based on UI components. It is maintained by Fb and a community of individual developers and companies.

installation of react js :

What is the use of create React app?

Difference between react ,angular :

Why we use ReactJS ?

Basic structure of our folder:

From the top we have node modules that is fill with many plugins like babel , prompt etc , after that we have public folder that includes index.html that is our base html file . Then we have src folder that contains index.js and index.css file . Index.js is our root js file. Igonering other files we look into package.json file that includes our packeages .

Print hello world program :

index.js

import React from ‘react’;

import ReactDom from ‘react-dom’;

ReactDom.render(<h1> Hello World techbuddies!</h1>,document.getElementById(‘root’));

In modern js we use import instead of var . First two lines we import two packages one is react and another is react-dom . After that with the help of ReactDom.render we render our content where we want .

Here document.getElementById(‘root’) :’root’ is come from index.html file in our public folder .

After start the npm server we check our browser with default address of react http://localhost:3000 .

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store