I have the following two components.
<Foo>
<Bars/>
<Foo>
When Foo
is called the console shows:
call Bar useEffect
Warning: Cant perform a React state update on an unmounted component...
call Foo useEffect
call Bar useEffect again
Here's the codepen but it doesn't generate the same warning which could be because its in development mode on my local. It does show null prints though.
https://codepen.io/rsgmon/pen/OJmPGpa
Is this component structure, with useEffect in each component, not recommended/allowed?
If it's ok what do I need to change to avoid the warning?