Episode 12: react interview questions and answers
from Be With Trends Hosted by Bhavik
Top 20 React Interview Questions and Answers Question - 1 : What is React? React is a JavaScript-based library that is used to create a SPA (Single Page Application) and different User Interfaces. React is developed and maintained by Facebook and other contributors. By using React, we can develop web and mobile applications by just following component-based architecture, and by using React we can get robust, scalable, and high-performance applications. React makes the task easier to create dynamic web applications because it requires less coding and offers more functionality along with the quick application configuration, unlike opposed to JavaScript, where the coding often gets complex very quickly over a period of time. Question - 2 : What is Virtual DOM in React? DOM plays an important role in terms of web application performance, thus there are tons of frameworks are available that manipulate the DOM directly by adding, modifying, or removing any existing element. When we perform any action on a page, at that time content should be updated based on the result of the action and it should be reflected in the DOM. In React, Virtual DOM plays an important role by updating DOM which is marked as dirty. React’s Virtual DOM converts the dirty component into a Virtual image of a component and compares it with the existing DOM, and based on the result of the comparison, the new DOM will be replaced by the existing DOM. The concept of a virtual DOM comes in and performs significantly better than the real or the actual browser DOM. The virtual DOM in React is only a virtual representation of the DOM which means every time the state of our application changes or any element in the DOM should be manipulated, the virtual DOM gets updated instead of the real DOM and this is how rendering will be better. For the execution of Virtual DOM in React, the diffi algorithm plays an important role to watch for the changes and does it requires a re-render of that section or not.
Embed this episode
No transcript yet.