Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

145
Vistas
Css not loading properly in Reactjs

I am working in reactjs and using (Nextjs) framework,I have All "css,js,images" in "public" folder and in "_app.js" i included all these files,But i whenever i tyring to open "Main page" in browser then page is not displaying (only loader showing) , In other words, webpage not displaying properly Here is my code in "_app.js",Where i am wrong ?

import Script from 'next/script'
import '../styles/globals.css'
import '../public/vendor/bootstrap/css/bootstrap.min.css'
import '../public/css/fontawesome.css'
import '../public/css/templatemo-stand-blog.css'
import '../public/css/owl.css'
//import {Helmet} from "react-helmet";
import {useEffect} from "react";
function MyApp({Component, pageProps}) {

useEffect(() => { // You can add more scripts if you repeat the same lines of code.
const script = document.createElement('script');
script.src = "../vendor/jquery/jquery.min.js";
script.async = true;
document.body.appendChild(script);

const script2 = document.createElement('script');
script2.src = "../vendor/bootstrap/js/bootstrap.bundle.min.js";
script2.async = true;
document.body.appendChild(script2);

return () => {
document.body.removeChild(script);
document.body.removeChild(script2);
 }
}, []);

//return ;
return (
    <>
      <Script src="https://www.google-analytics.com/analytics.js" />
        <Component {...pageProps} />
    </>
  )
}

export default MyApp
about 4 years ago · Santiago Gelvez
1 Respuestas
Responde la pregunta

0

refer to this article about including scripts in you NextJs project https://nextjs.org/docs/basic-features/script

You need to create _document.js file where you will place your scripts tags by importing

import Script from 'next/script'

the code your writing should not be in the _app.js file

something like this

export default function Document() {
  return (
    <Html>
      <Head />
      <body>
        <Main />
        <NextScript />
        <Script
          src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.20/lodash.min.js"
          strategy="beforeInteractive"
        ></Script>
      </body>
    </Html>
  )
}
about 4 years ago · Santiago Gelvez Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda