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

146
Views
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 answers
Answer question

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