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

364
Visualizações
Warning: Cannot update a component (`ForwardRef`) while rendering a different component (`Parent`). To locate the bad setState() call inside `Parent`,

I have two different setStates in parent component

 const [ isVisible, setIsVisible ] = useState(false);
 const [ validImagePath, setValidImagePath ] = useState(null);

also has handle functions in parent

const handleVisibility = bool => setIsVisible(true);
const handleImagePath = path => setImagePath(path);

that parent has two child components

<Child1 handleVisibility={handleVisibility} isVisible={isVisible}/> 
<Child2 validImagePath={validImagePath} handleVisibility={handleVisibility} isVisible={isVisible} />

When parent component is rendered then is visible and onClick it sets a state that it renders <Child 2/>. Everything works fine but I get this warning: Warning: Cannot update a component (ForwardRef) while rendering a different component (Parent). To locate the bad setState() call inside Parent, follow the stack trace as described in https://reactjs.org/link/setstate-in-render.

Please help in resolving this warning.

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