ReactDOM.render()

Hi this is small post where I’m explaining the ReactDOM.render() that we have in our react applications.

Initially when we create a React application we have this code in the index.js file:

Here we are using the ReactDOM from ‘react‘ that have a method called .render() this method render (visualize) a react element in the passed DOM node, in this case the “id” node.

// React dependencies
import React from 'react'
import ReactDOM from 'react-dom'

// Componentes
import App from './App'

ReactDOM.render(
  <App />,
  document.getElementById('root)
)

So, all the result of <App /> component is inserted into the DOM as a child of the div with id “root”

The point where that result (<App />) is inserting into the DOM is what we call mounting a component.

And when React delete your component information from the DOM this is called unmounting

For other changes in the react component this is called Update the component.

By Cristina Rojas.