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

192
Visualizações
React design question to load third party javascript file

I am new to UI development.So just had design question and wanted to get some thoughts if the approach I am taking is correct.

Use Case: I have to conditionally load a large third party Marketing JS file. And then use this JS API's in 2 of my components.

Design I have:

  1. Create Provider Component just to load this JS file and isScriptLoaded state to capture if it's 'loaded' or 'failed'. NOTE: There could be more props besides isScriptLoaded in future that I might need to flow down to children.

  2. Create a render less i.e.render => (return null) Child-1 Component that would just make an API call if isScriptLoaded is 'loaded' to redirect the page based on response.

  3. Create Child-2 Component that would just make an API call if isScriptLoaded is 'loaded' , to load dynamic content on current page.

Does above design look ok ?

NOTE: I cannot lazy load as it's recommended by vendor to load script right in the beginning to avoid bad user experience.

Thanks!

about 4 years ago · Santiago Trujillo
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