Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

214
Visualizações
Why is next.js giving me this error: 'Anonymous arrow functions cause Fast Refresh to not preserve local component state.'

I had a project in a git repo. I tried to push it to github and it wouldn't let me. It said the version on github was more recent than the one on my local machine. But I only dev on this machine, and I had not pushed new changes for days. So I had a lot of changes I didn't want to lose. So, I just tried to delete the .git file and start fresh. But it was giving me issues. So I just copied the entire file structure over to a new file to start fresh. But now it is giving me a warning 'Anonymous arrow functions cause Fast Refresh to not preserve local component state.'

I had never gotten this warning when working out of the other folder.

What's even more confusing, the page it is throwing a warning for, the _app.js file, exports a named function.

I dont understand.

Here's the _app.js file.

import '../styles/globals.css'
import Layout from '../components/Layout';
import { useState } from 'react';

export default function MyApp({ Component, pageProps }) {
  // state
  let [activeTab, setActiveTab] = useState('Sign In')

  return (
    <Layout activeTab={activeTab}>
      <Component {...pageProps} />
    </Layout>
  )
}

I even checked the layout component, wondering if that one was anonymous. It's not.

import styles from '../styles/styles.module.scss';
import Sidebar from './Dashboard/Sidebar';

export default function Layout({children, activeTab}){
    return (
        <div className={styles.container}>
            <div className={styles.main}>
            <div className={styles.dash}>
                <Sidebar activeTab={activeTab}/>
                <div className={styles.content}>
                    {children}
                </div>
            </div>
            </div>
        </div>
    )
}
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda