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

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