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

147
Vistas
loading external js library in reactjs

I created a javascript library using webpack

I added the file into my react application:

import {Helmet} from "react-helmet";
ReactDOM.render(
  <React.StrictMode>
    <Helmet>
       <script src="/static/lib.js"/>
    </Helmet>
    <App />
  </React.StrictMode>,
 document.getElementById('root')
 );

when I was checking the site sources - I found out that lib.js exists in there. I have a component that needs to create an object that exists inside the lib.js file

#myComponent.js
class MyComponent extents Component {
    constructor(){
      this.obj = new MyObject() // here is the problem
    }
}
    render() {
       return <div className="main-background">
         some stuff
        </div>;
    }
}

I suspect that the problem has something to do with DomReady - the library probably doesn't get loaded and the module is not defined

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

0

my solution was to put my deploy the sdk project which I had into npm and npm install it

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