Answers ( 2 )

  1. Please briefly explain why you feel this answer should be reported .

    Report
    Cancel

    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

  2. Please briefly explain why you feel this answer should be reported .

    Report
    Cancel

    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.

    1. Whenever anything may have changed, the entire UI will be re-rendered in a Virtual DOM representation.
    2. The difference between the previous Virtual DOM representation and the new one will be calculated.
    3. The real DOM will be updated with what has actually changed. This is very much like applying a patch.

Leave an answer

sasireka

About sasirekaGuest