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

191
Views
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
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!