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

150
Vistas
Why is react-font-picker gives error "Error: Cannot update active font: "Fira Sans" is not in the font list"?

I am using font picker in my project like this.

<FontPicker
                          apiKey={process.env.REACT_APP_GOOGLE_API_KEY}
                          activeFontFamily={activeFontFamilyMobile}
                          onChange={(nextFont) =>
                            setActiveFontFamilyMobile(nextFont.family)
                          }
                        />

The already saved font in stored in the backend, which I am fetching and setting up like this in use Effect:

            setActiveFontFamilyMobile(response.data.font_family);

and by default, the state is like this:

  const [activeFontFamilyMobile, setActiveFontFamilyMobile] = React.useState("Raleway");

So the problem is that when the page loads for the first time, saved font_family comes from the backend and is stored in activeFontFamilyMobile. And in the parameters of fontPicker, it should be displayed by activeFontFamily={activeFontFamilyMobile}. But it gives error like this: Error

But if I make some changes in the code and cause a re-render, it starts working. So its not working when the pages loads first time. What might be the issue?

almost 4 years ago · Santiago Trujillo
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