Under the Hood: ReactDOM.render()

react-dom

  1. First, on line 3, the render() function can receive three parameters: element, container and, callback.
  2. Then, on line 4 the function will make a validation, where it will check if the document.getElementById(‘app’) argument that we passed is a element, document, document fragment or comment node.
  3. After this, it will validate if the container argument that we passed was previously passed to ReactDOM.createRoot(), which is not supported.
  4. Last, after these validations, it will return the function legacyRenderSubtreeIntoContainer with the parameters:

--

--

--

26 yo. Self-Taught Software Developer. I write about Career Change, Women in Tech and anything exciting I’m working on.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

GraphQL basics and practical examples with Vue

Four “for”

MVC with Node, Express and React

Visualizing Resque Usage using Node.js, Websockets, and Redis

Arrow Function

Rapidly building and MVP with Rails and Vue

How to fix, You called the function ‘Value Selector’ with these arguments error.

Filtering by Multiple Attributes

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Alejandra Bricio

Alejandra Bricio

26 yo. Self-Taught Software Developer. I write about Career Change, Women in Tech and anything exciting I’m working on.

More from Medium

React 18.0 has been released! I will try to summarize what’s new in one word:

Using Emotion in React App

Why does my useEffect call twice in React 18?!

React.memo with useCallback to avoid optimising the rendering in React