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

124
Views
¿Por qué mis archivos externos JS no se cargan en mi página de reacción?

Estoy agregando secuencias de comandos dinámicamente a mi aplicación de reacción como esta

 export const appendScript = (scriptToAppend : string) => { const script = document.createElement("script"); script.src = scriptToAppend; script.async = true; script.type = "text/jsx"; document.body.appendChild(script); }

Componente de la aplicación

 class App extends React.Component { componentDidMount() { appendScript("./assets/custom.min.js"); } }

archivo personalizado.min.js

 $(document).ready(function(){ alert("ready"); })
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Verifique la respuesta en https://stackoverflow.com/a/34425083/13558764 .

O puede probar el paquete "react-helmet".

Aquí hay un ejemplo de uso.

 import React from "react"; import {Helmet} from "react-helmet"; class Application extends React.Component { render () { return ( <div className="application"> <Helmet> <script src="https://use.typekit.net/foobar.js"></script> <script>try{Typekit.load({ async: true });}catch(e){}</script> </Helmet> </div> ); } };
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!