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

212
Vistas
Importing ReactDOM doesn't render anything

I'm pretty new to React and I've been trying to set up a REACT app. However, I always get a blank page. Can anyone help?

HTML Code (index.html)

<html>
  <head>
    <meta charset="UTF-8" />
    <title>Home</title>
  </head>
  <body>

    <div id="root"></div>
    <script src="index.js" type="text/babel"></script>

  </body>
</html>

Javascript (index.js)

import React from "react"
import ReactDOM from "react-dom"

const page = (
  <div>
    <h1>My page</h1>
  </div>
)

ReactDOM.render(page, document.getElementById("root")); 

And yes, I am using a live server to run this code.

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

0

Browsers don't understand the text/babel MIME type.

It is there for Babel to search the DOM for scripts that it should process to convert from whatever they are (JS + JSX in this case) to JS.

You haven't included Babel in your page though.

You have a further problem in that inside your script you have import statements which depend on Node.js module resolution (and you're using a browser, not Node).


You should start at the beginning of the React guide.

You currently have an odd mix of about 20% of the quick guide to adding React to a website and 5% of using a Node.js based toolchain to transpile your code.


I recommend starting with create-react-app as it gives you a robust, performant foundation to get started with.

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