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

335
Vistas
Next.js - Anonymous arrow functions cause Fast Refresh to not preserve local component state (warning)

I'm currently experiencing this warning pointing at an unnamed object in a config file, and naming it doesn't resolve the warning. Below is the detailed warning and examples.

Warning:

Anonymous arrow functions cause Fast Refresh to not preserve local component state.
Please add a name to your function, for example:

Before
export default () => <div />;

After
const Named = () => <div />;
export default Named;

Before:

export const = {
  apiUrl: process.env.NEXT_PUBLIC_API_URL as string,
  commitRef: process.env.NEXT_PUBLIC_VERCEL_GIT_COMMIT_REF as string,
  ldSdkKey: process.env.NEXT_PUBLIC_LD_SDK_KEY as string,
  imgixBaseUrl: process.env.NEXT_PUBLIC_IMGIX_BASE_URL as string,
  imgixApiKey: process.env.NEXT_PUBLIC_IMGIX_API_KEY as string,
  imgixResourceID: process.env.NEXT_PUBLIC_IMGIX_RESOURCE_ID as string,
};

Attempted Resolution ./src/config.ts:

const AppConfig = {
  apiUrl: process.env.NEXT_PUBLIC_API_URL as string,
  commitRef: process.env.NEXT_PUBLIC_VERCEL_GIT_COMMIT_REF as string,
  ldSdkKey: process.env.NEXT_PUBLIC_LD_SDK_KEY as string,
  imgixBaseUrl: process.env.NEXT_PUBLIC_IMGIX_BASE_URL as string,
  imgixApiKey: process.env.NEXT_PUBLIC_IMGIX_API_KEY as string,
  imgixResourceID: process.env.NEXT_PUBLIC_IMGIX_RESOURCE_ID as string,
};

export default AppConfig;

Hopefully someone else has experienced this and found a resolution.

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

0

Turns out the issue was that our older version of Next.js didn't point towards the correct cause of the warning, but still served the warning. Updating next guided me towards the problem code and I was able to resolve it.

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