ReactJS is an open-source front-end JavaScript library for building user interfaces. ReactJS is maintained by Facebook and a community of individual developers and companies. It is widely used as a base in building single-page websites and mobile applications. It is very easy to use, and it allows users to create reusable UI components.
JSX : JSX is an extension to javascript. Though it is not mandatory to use JSX in react, it is one of the good features and easy to use.
Components: Components are like pure javascript functions that help make the code easy by splitting the logic into reusable independent code.
We can use components as functions and components as classes. Components also have a state, props which makes life easy.
Inside a class, the state of each of the props is maintained.
Virtual DOM: React creates a virtual dom, i.e., in-memory data -structure cache. Only the final changes of DOM has later updated in the browsers DOM.
Javascript Expressions: JS expressions can be used in the jsx files using curly brackets, for example {}.
JSX is an extension to javascript. It is a template script where you will have the power of using HTML and Javascript together
For a UI, we need Html, and each element in the dom will have events to be handled, state changes, etc. In case of React, it allows us to make use of Html and javascript in the same file and take care of the state changes in the dom in an efficient manner.
Here is a simple example of how to use expressions in JSX.
In earlier ReactJS examples, we had written something like :
index.js
Components are like pure javascript functions that help make the code easy by splitting the logic into reusable independent code.