O'Reilly logo

Jasmine JavaScript Testing - Second Edition by Paulo Ragonha

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The Virtual DOM

When you define a component's render method and invoke the React.createElement method, you are not actually rendering anything in the document (you are not even creating DOM elements).

It is only through the React.render function that the representation created by invoking these React.createElement calls are effectively converted into real DOM elements and attached to the document.

This representation, defined by ReactElements, is what React calls the Virtual DOM. And ReactElement must not be confused with DOM elements; it is instead a light, stateless, immutable, virtual representation of a DOM element.

So why did React get into the trouble of creating a new way of representing the DOM? The answer here is performance.

As browsers ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required