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

245
Views
Reaccionar no funciona: no se puede usar la declaración de importación fuera de un módulo

¿Por qué reacciona no funciona aquí?

 <script src="index.js" ></script>

Nota: el código anterior se encuentra en el html principal

aquí está el archivo react.js

importar React desde 'react' importar ReactDOM desde 'react-dom'

 const page = ( <div> <ul> <li>Anime Title</li> <li>Genre</li> <li>Rating</li> <li>Status</li> </ul> </div> ) ReactDOM.render(page, document.getElementById("root"))

Cada vez que traté de ejecutar esto, dice "no se puede usar la declaración de importación fuera de un módulo" ¿Hice mal al instalar react-js?

por cierto aquí está el paquete.json

 { "name": "try", "version": "0.1.0", "private": true, "dependencies": { "@testing-library/jest-dom": "^5.16.5", "@testing-library/react": "^13.3.0", "@testing-library/user-event": "^13.5.0", "react": "^18.2.0", "react-dom": "^18.2.0", "react-scripts": "5.0.1", "web-vitals": "^2.1.4" }, "scripts": { "start": "react-scripts start", "build": "react-scripts build", "test": "react-scripts test", "eject": "react-scripts eject" }, "eslintConfig": { "extends": [ "react-app", "react-app/jest" ] }, "browserslist": { "production": [ ">0.2%", "not dead", "not op_mini all" ], "development": [ "last 1 chrome version", "last 1 firefox version", "last 1 safari version" ] } }
about 4 years ago · Juan Pablo Isaza
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!