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

111
Vistas
React unable to find html document while using Django Backend

I am trying to configure a react frontend with a django backend and everything is fine, it complies, it loads etc.

The issue i am facing is that my react component is unable to find the actual index.html document Uncaught ReferenceError: root is not defined

my react app is constructed the standard way

 in ./src/components/App.js

//proper imports up here {react, reactDOM} 

export default function App(){
  return (
    <h1>hello world</h1>
  )
}

root = reactDOM.createroot(document.getElementById('root))

root.render(<App />)

In my index.js located in .src/index.js

import App from './components/App.js'

and my webpack config file points to this index.js file

Yes, I have ensured there is a div with an id of root in my boilerplate HTML

The django backend compiles fine, and using webpack/babel things seem to be fine on that end. Bu that error is what pops up in the chrome console upon loading.

The urls and views are properly set up and any html/css I add to the page displays as expected

Thank you in advance

about 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

I needed to use let/const before defining root.

I am an idiot

about 4 years ago · Santiago Trujillo 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