DEV Community

Discussion on: Avoiding useEffect with callback refs

Collapse
 
rounakcodes profile image
rounakcodes

Many times when I read React docs or blogs from people closer to the React team, I find them briefly referring to some use case or some kind of components suitable for a React API without actually explaining the same in depth. I fail to confidently understand their discussion due to the incomplete context. I appreciate that you have taken the pain to demonstrate everything to the last detail. I would like to read more such articles. Thanks.

Collapse
 
fjones profile image
FJones

The same holds true for what not to use specific APIs for. The useEffect doc, for instance, discourages the use for data fetching, except it only gave vague indications to use event handlers instead, last time I read it. Sometimes, conceptualizing what the intended solution would be becomes rather difficult indeed.
This post does a much better job explaining callback refs (although a bit more detail on why ref uses referential integrity to determine whether to rerun would be nice)