Book Image

Jasmine JavaScript Testing Update

By : Paulo Vitor Zacharias Ragonha
Book Image

Jasmine JavaScript Testing Update

By: Paulo Vitor Zacharias Ragonha

Overview of this book

Table of Contents (15 chapters)

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 evolved, JavaScript performance kept getting better and better, and today's application bottlenecks aren't actually JavaScript. You've probably heard that you should try touching the DOM as little as possible, and React allows you to do that by letting...