Using virtual dom in react js top 5 benefits

Page 1

Using Virtual DOM in React.js: Top 5 Benefits

Introducing React.js and Virtual DOM? React.js is an open-source JavaScript library for building user interfaces. The virtual DOM is a node tree listing content, and elements and their attributes as objects and properties. The render() method of React creates a node tree from React components and updates this node tree due to the mutations caused by actions in the data model. When compared to the real DOM, Virtual DOM is in -memory representation of Real DOM. It is lightweight JavaScript object which is simply a copy of the Real DOM. React.js maintains 2 virtual DOM at any instance of time. One of them is the updated state virtual DOM and other is the previous state virtual DOM . Minimizing the time it takes to repaint the screen is one of the biggest concerns of Browser makers. The most appropriate thing that can be done is to minimize and batch the DOM changes that necessitates redrawing. This strategy where the DOM changes are batched and reduced, at another level of abstraction, is the idea behind React’s Virtual DOM.


Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.