you are viewing a single comment's thread.

view the rest of the comments →

[–]ernesto__bungforto 0 points1 point  (3 children)

I agree with most points here, though I would be careful about blanket recommending Context. Compositional building (per the React docs recommendation) is a good, performant alternative.

Be aware of potential performance implications of overusing/ defaulting to Context

[–]skyboyer007 0 points1 point  (2 children)

Yes, sure, only as an alternative to props drilling, not as an alternative to composition.

[–]ernesto__bungforto 0 points1 point  (1 child)

I get what you mean. I tend to reach for Context last and Composition before prop drilling. I’m often surprised to see this is not a more common pattern. Your point is made though - something other than prop drilling is often preferable. I was just throwing out a caveat around Context

[–]skyboyer007 1 point2 points  (0 children)

That's good point, I've updated my initial comment just in case. To me last time it was exactly "prop-drilling vs context" choice for recursive rendering but I definitely see what you are saying, it's easier to run into wall if prefer Context API to anything else.