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

227
Views
Cómo ejecutar scripts en index.html en reaccionar si no tiene index.html

Todavía soy nuevo en React. Tengo la aplicación web React a la que necesito agregar varios scripts. Aunque los scripts deben estar dentro de la etiqueta del cuerpo en index.html . Como esto :

 <!DOCTYPE html> <html lang="en"> <head> <title>React example</title> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <style media="only screen"> html, body, #root { height: 100%; width: 100%; } </style> </head> <body> <div id="root">Loading React example&hellip;</div> <script src="https://unpkg.com/systemjs@0.19.39/dist/system.src.js" > </script> <script src="systemjs.config.js"></script> <script> System.import('./index.jsx').catch(function(err) { console.error(err); }); </script> </body> </html>

Pero el problema es que mi aplicación no tiene index.html , solo tiene index.js . Intenté agregar este script con document.write pero creo que es una forma incorrecta de hacerlo. Además de eso, tengo errores semánticos y sintácticos que no puedo entender, también se adjuntan aquí .

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Puede agregar los scripts en su código de reacción con:

 let script = document.createElement("script"); script.setAttribute("src", scriptUrl); script.setAttribute("type", "text/javascript");

(esto es para secuencias de comandos vinculadas, pero las secuencias de comandos incrustadas se pueden hacer de manera similar)

about 4 years ago · Juan Pablo Isaza Report
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!