Home > Blockchain >  Difference between React element and Browser DOM element
Difference between React element and Browser DOM element

Time:08-30

Browser DOM elements are something that we see on screen and the same goes true for React elements. They both can have classes. The only distinction as far as I understand is that the Browser DOM element is handled by Browser DOM but React element is handled by React Virtual DOM. Although there are some syntactical differences. Apart from that what makes React element different from the Browser DOM element?

CodePudding user response:

HTML elements are standardized and depending on the type of element sometimes semantic. They are understood by software such as crawlers, robots, screen readers, browser extensions. plugins and assistive software.

React JSX elements are parsed and deconstructed into JavaScript code at compile time.

Example the React JSX markup:

<Hello toWhat="World" />

Gets compiled into:

React.createElement(Hello, {toWhat: 'World'}, null)

CodePudding user response:

React controls how and when it will update the actual dom. Another difference is updating the virtual dom is more efficient than updating the actual dom.

This process is called reconciliation.

https://reactjs.org/docs/reconciliation.html

  • Related