Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

273
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!