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

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

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