concept dom in category isomorphic web applications

appears as: DOM, DOM
Isomorphic Web Applications: Universal Development with React

This is an excerpt from Manning's book Isomorphic Web Applications: Universal Development with React.

The server does three important things. First, it fetches the data required for the view. Then it takes that data and uses it to render the DOM. Finally, it attaches that data to the DOM so the browser can read in the app state. Figure 1.5 shows the flow on the server.

To build the view for the recipes app, I’ll show you how to take advantage of React to implement a declarative view that can be used to render both on the server and the browser. React offers a render cycle that allows you to easily separate which code will run on both the server and browser and which will run on only the browser. Additionally, React comes with built-in methods for constructing the DOM on both the server and the browser.

Listing 2.4. Browser entry point—src/main.jsx
import React from 'react'; #1 import ReactDOM from 'react-dom'; #1 import App from './components/app.jsx'; #2 require('./style.css'); #3 ReactDOM.render( #4 <App />, #4 document.getElementById('react-content') #4 ); #1 Imports React dependencies #2 Includes root App component #3 Includes styles #4 Renders the App component into the DOM—second parameter indicates the DOM element React should be rendered into !@%STYLE%@! {"css":"{\"css\": \"font-weight: bold;\"}","target":"[[{\"line\":0,\"ch\":63},{\"line\":0,\"ch\":65}],[{\"line\":1,\"ch\":63},{\"line\":1,\"ch\":65}],[{\"line\":10,\"ch\":0},{\"line\":10,\"ch\":2}],[{\"line\":0,\"ch\":63},{\"line\":0,\"ch\":65}],[{\"line\":1,\"ch\":63},{\"line\":1,\"ch\":65}],[{\"line\":10,\"ch\":0},{\"line\":10,\"ch\":2}],[{\"line\":2,\"ch\":63},{\"line\":2,\"ch\":65}],[{\"line\":11,\"ch\":0},{\"line\":11,\"ch\":2}],[{\"line\":3,\"ch\":63},{\"line\":3,\"ch\":65}],[{\"line\":12,\"ch\":0},{\"line\":12,\"ch\":2}],[{\"line\":5,\"ch\":63},{\"line\":5,\"ch\":65}],[{\"line\":6,\"ch\":63},{\"line\":6,\"ch\":65}],[{\"line\":7,\"ch\":63},{\"line\":7,\"ch\":65}],[{\"line\":13,\"ch\":0},{\"line\":13,\"ch\":2}],[{\"line\":5,\"ch\":63},{\"line\":5,\"ch\":65}],[{\"line\":6,\"ch\":63},{\"line\":6,\"ch\":65}],[{\"line\":7,\"ch\":63},{\"line\":7,\"ch\":65}],[{\"line\":13,\"ch\":0},{\"line\":13,\"ch\":2}],[{\"line\":5,\"ch\":63},{\"line\":5,\"ch\":65}],[{\"line\":6,\"ch\":63},{\"line\":6,\"ch\":65}],[{\"line\":7,\"ch\":63},{\"line\":7,\"ch\":65}],[{\"line\":13,\"ch\":0},{\"line\":13,\"ch\":2}]]"} !@%STYLE%@!
Figure 3.4. The continuous update and diff cycle that React goes through to keep the DOM up-to-date