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

950
Views
Uncaught Error: createRoot(...): Target container is not a DOM element

Cannot render react component. I have created multiple html pages in public folder, index.js file is kept in src folder. I want to render react component in one of the html file inside the bootstrap "row" container. My Error image

HTML:

    <div class="row">
        <div class="col-lg-4 col-mg-6 col-sm-12">
    
          <div id="root"></div>
    
        </div>
        
    </div>
    
    <script src="../src/index.js" type="text/jsx"></script>
    
    </body>
    
    </html>

index.js

import { StrictMode } from "react";
import { createRoot } from "react-dom/client";
import App from "./Components/App";
    
const rootElement = document.getElementById("root");
const root = createRoot(rootElement);

root.render(
   <StrictMode>
      <App />
   </StrictMode>
);
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Have you tried:

import React from "react";
import ReactDOM from "react-dom/client";
import "./index.css";
import App from "./App";
import reportWebVitals from "./reportWebVitals";

const root = ReactDOM.createRoot(document.getElementById("root"));
root.render(
  <React.StrictMode>
    <App />
  </React.StrictMode>
);

reportWebVitals();
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!