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

219
Views
How can javaScript library and css files load before component load in reactjs

How can javaScript library and css files load before reactjs component load.

I am converting dataTable Html template to react component but javaScript library and css files are isn't loaded with components.

How can I solved it. Can any one help me?

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

You can use these lines at your very first component like app.js which renders first ater index.js(for class based components)

    componentDidMount () {
    const script = document.createElement("script");

    script.src = "https://use.typekit.net/foobar.js";
    script.async = true;

    document.body.appendChild(script);
}

And for functional components

useEffect(() => {
    const script = document.createElement("script");

    script.src = "https://use.typekit.net/foobar.js";
    script.async = true;

    document.body.appendChild(script);
}, []);
about 4 years ago · Juan Pablo Isaza Report

0

You can try to use import [ which js library you want to use ] and then put this syntax at the js file top like as you import react;

import $ from 'jquery';

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!