React Js
React is an open-source JavaScript library which is used for building user interfaces based on UI components specifically for single-page applications.
Some advantages of React are:
- It is easy to learn.
- A virtual DOM is used in React.
- There are reusable components.
- It operates on a one-way data flow.
- SEO friendliness.
JSX
JSX is a JavaScript Extension Syntax which is used in React to easily write HTML and JavaScript together. It allows us to write HTML elements in JavaScript and place them in the DOM without any createElement() or appendChild() methods.
JSX converts HTML tags into react elements. It is faster than regular JavaScript.
Virtual DOM
Virtual DOM is a light-weight abstraction of the real DOM. A virtual DOM object has the same properties as a real DOM. Manipulating the virtual DOM is much faster than the real DOM.
In React, once the virtual DOM has been updated, it compares the current version of the virtual DOM with the previous version of the virtual DOM. This process is called “diffing” and the diff algorithm does that process in react. So, once React knows which virtual DOM objects have changed, then React updates only those objects, in the real DOM.
Top comments (0)