Creé una aplicación de reacción y recibo el mensaje de error:
Uncaught SyntaxError: import declarations may only appear at top level of a modulemi index.html se ve así:
<html> <head> </head> <body> <div id="root"> <!-- This element's contents will be replaced with your component. --> </div> <script src="https://unpkg.com/react@18/umd/react.development.js" crossorigin></script> <script src="https://unpkg.com/react-dom@18/umd/react-dom.development.js" crossorigin></script> <script src="index.js"> </script> </body> </html>y mi index.js correspondiente así:
import React from 'react'; console.log("test") ReactDOM .createRoot(document.getElementById('root')) .render(<h1>Hello, world!</h1>);Solo estoy tratando de hacer un hola mundo simple desde el sitio web de reacción. ¿Qué estoy haciendo mal?