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

147
Vistas
Fonts loading in production only after reloading the page - React js, emotion

I am using emotion's Global component to apply a global font to my app:

export const GlobalStyle: FC<{}> = () => (
  <Global
    styles={css`
      @import url('https://fonts.googleapis.com/css2?family=Poppins:wght@100;300;400;500;700;900&display=swap');

      body {
        font-family: 'Poppins', sans-serif;
      }
`}
  />

This approach works perfect well on localhost, but in production it does not: when I first load the page some default font appears (Liberation serif), not Poppins. Poppins is applied to the body only after I refresh the page.

My impression is the page is rendered before the font is available, and this is the reason why the correct font is displayed when the page is refreshed (by that time the font is already available), but not when I first load it.

Any help would very appreciated, as I tried to look for a solution everywhere, but was not able to find any.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

I eventually solved the problem. It was due to a conflict with the library react-select (which I was also using), that also has emotion as a dependency. React-select had emotio v 11, while my app still had emotion 10. After updating emotion to v 11, the problem disappered. https://emotion.sh/docs/emotion-11

about 4 years ago · Juan Pablo Isaza 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