1.

How virtual DOM works in React native?

Answer»

Virtual DOM was popularised by React core team member Pete Hunt. React explains its performance aspect by using this term. They explained that the DOM manipulation is always a heavy operation as browser reflow, repaint event gets triggered by DOM manipulation. The browser needs to recalculate the position of elements by upcoming change. To optimise this browser operation, ReactJS tries to minimize DOM manipulation operations. React creates an in-memory data structure CACHE, computes the RESULTING differences, and then updates the browser’s displayed DOM efficiently. This allows developers to WRITE code as if the entire PAGE is rendered on each change while the React libraries only render subcomponents that actually change. That is how React increases the space complexity by KEEPING data structure in memory but reducing the processing cost by reducing the number of DOM manipulation an updated needs to make an actual DOM.



Discussion

No Comment Found