React is a Javascript library for building user interfaces. It is considered the « V » from the MVC pattern.
React was created to solve one problem: building large applications with data that changes over time.
A React application is build in terms of components. Javascript classes are used when declaring React components.
A component must extend the React.Component class and it must have a render method.
The Virtual DOM is an in-memory representation of the real DOM. It is generated by the components before any changes are made to the page. It happens between the render function being called and displaying of elements. . So, there are two steps:
- The render method of the component returns some markup but it is not the final HTML yet. It is an in-memory representation.
- The HTML is displayed in the browser.
This makes react faster. It is called diffing and it allows React to minimize changes as a result of user actions.
ReactDOM.Render method is called to render components to a web page.