The speed of plain objects meets the power of the UI.
JSX looks like HTML, but it compiles down to plain JavaScript objects. This is the Virtual DOM.
// What you write
<div className="btn">
Click Me
</div>// What React sees
React.createElement(
'div',
{ className: 'btn' },
'Click Me'
)A lightweight object description. Creating 1000 of these is instant. Creating 1000 real DOM nodes is slow.
{
type: 'div',
props: {
className: 'btn',
children: 'Click Me'
},
key: null,
ref: null,
$$typeof: Symbol(react.element)
}