How React works? How Virtual-DOM works in React?
ReportQuestion
Please briefly explain why you feel this question should be reported .
in progress
0
Education, Schools, and Learning
2 years
2 Answers
522 views
Guest 0
Answers ( 2 )
Please briefly explain why you feel this answer should be reported .
React creates a virtual DOM. When state changes in a component it firstly runs a “diffing” algorithm, which identifies what has changed in the virtual DOM. The second step is reconciliation, where it updates the DOM with the results of diff.
https://www.gangboard.com/app-programming-scripting/react-js-course
Please briefly explain why you feel this answer should be reported .
React is divided into two major APIs. First, there’s the React DOM. This is the API that’s used to perform the actual rendering on a web page. Second, there’s the React component API. These are the parts of the page that are actually rendered by React DOM.
Like the actual DOM, the Virtual DOM is a node tree that lists elements and their attributes and content as objects and properties. React’s render() method creates a node tree from React components and updates this tree in response to mutations in the data model, caused by actions.
Each time the underlying data changes in a React app, a new Virtual DOM representation of the user interface is created
This is where things get interesting. Updating the browser’s DOM is a three-step process in React.