I am implementing a Skeleton for a Card component as such:
{ loadingContext & <MySkeleton/> : <Card/> }
However, for this to truly work properly, I need to test for the image within the Card component to finish loading through something like:
<img onload={() => setLoadingContext(false)} .../>
But, this Card component code doesn't get called until loading is set to false, and the code that sets loadingContext to false is in the Card component. A negative infinite loop if you like.
The question is, then, how do I effectively check that the Card component's image has completely loaded in this situation?
Cheers, Matt