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

196
Views
How to include js file in Reactjs

I am working with Reactjs,I want to link "js" file means i want to include "js" file in my project but its not working, I put my code in "app.js" file,My js files exist in "public" folder,I put code in "_app.js" file and Here is my current code in "_app.js" file

import '../styles/globals.css'
import '../public/css/style.css'
import '../public/css/fonts.css'
import '../public/css/bootstrap.css'
import '../public/css/fonts2.css'
import Script from 'next/script'
function MyApp({ Component, pageProps }) {
  return (
             <> 
                <script src="../js/core.min.js"></script>
                <script src="../js/script.js"></script>
            <Component {...pageProps} />
            </>
        );  
}

export default MyApp
about 4 years ago · Santiago Gelvez
1 answers
Answer question

0

There are several solutions described here: Add js script with react

Here is one:

import '../styles/globals.css'
import '../public/css/style.css'
import '../public/css/fonts.css'
import '../public/css/bootstrap.css'
import '../public/css/fonts2.css'
import Script from 'next/script'
function MyApp({ Component, pageProps }) {
    const script = document.createElement("script");
    script.src = "../js/core.min.js";
    script.async = true;
    document.body.appendChild(script);
    const script2 = document.createElement("script");
    script2.src = "../js/script.js";
    script2.async = true;
    document.body.appendChild(script2);
  return (
             <> 
            <Component {...pageProps} />
            </>
        );  
}

export default MyApp

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