Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

149
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda