Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

110
Visualizações
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 Respostas
Responde à pergunta

0

I needed to use let/const before defining root.

I am an idiot

about 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda