DEV Community

Cover image for Short Note of React
Tonmoy Roy
Tonmoy Roy

Posted on • Updated on

Short Note of React

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 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)

An Animated Guide to Node.js Event Loop

Node.js doesn’t stop from running other operations because of Libuv, a C++ library responsible for the event loop and asynchronously handling tasks such as network requests, DNS resolution, file system operations, data encryption, etc.

What happens under the hood when Node.js works on tasks such as database queries? We will explore it by following this piece of code step by step.