Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

275
Vistas
Why React needs to check if the node is root before rendering?

I am learning about React internals from a talk by Paul O’Shannessy "Building React from scratch"

In "7:29" before explaining how rendering process work, he added these few lines of code which i really couldn't understand

const ROOT_KEY = 'dlthmRootId";
const instancesByRootId = {};
let rootId = 1;

function isRooot(node) {
 if(node.dataset[RootKEY]) {
   return true
 }
 else {
   return false
 }
}

He said that we need to make sure that no roots conflict!

I can't understand this part, what roots to conflict, is this related to server side rendering? or rendering to multiple roots instead of one root node in the app?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

React app will be initialized in DOM with the code below.

import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';

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

What it does is render React component into an element in DOM with the id 'root'.

Therefore, if there is any case where the root element will be duplicated or two React apps attempt to manipulate one single root element, that would be called root 'conflicts'.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda