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

217
Visualizações
NOT getting updated content with every render

I'm new to Next.js. I'm facing a problem where I am not able to load my new content on the page. Next.js keeps showing the old content which I already deleted from the code. Why does prior content show?

Here is the last code which I delete but still it is showing on the source tab of chrome.

export const UploadWrapper = () => {
    // const img__isClicked = ;
    const img__isClicked = useSelector(state => state);

    useEffect(() => {
        console.log('uploadWrapper', img__isClicked);
    }, [img__isClicked])

    return (
        <section>
            <UploadDropzone />
            {(img__isClicked) ? console.log('hurray I got you') : null }
        </section>
    )
}

Here is the updated code which is not showing on the page:

export const UploadWrapper = () => {
    // const img__isClicked = ;
    const img__isClicked = useSelector(state => state.img__isClicked);

    useEffect(() => {
        console.log('uploadWrapper', img__isClicked);
    }, [img__isClicked])

    return (
      <>
        <section>
            <UploadDropzone />
        </section>
        <aside>
            {(img__isClicked === true) ? <TagsWrapper /> : null }
        </aside>
      </>
    )
}

If I wish to see fresh content then I have to restart the whole server again.

event the console is showing me

Hurray I got you

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

It is because new render doesn't happen when you don't change the state inside the component. You could create imgClicked state like this:

export const UploadWrapper = () => {
  const [imgClicked, setImageClicked] = useState(false);
  const img__isClicked = useSelector(state => state.img__isClicked);

  useEffect(() => {
    setImageClicked(img__isClicked); // <--- This state change will trigger re-render of the component.
  }, [img__isClicked])

  return (
    <>
      {imgClicked ? <TagsWrapper /> : null}
    </>
  )
}

about 4 years ago · Juan Pablo Isaza Relatório
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