Igor Snitkin
Sep 22, 2023

Alright Giuseppe, I’ll be a bit critical, sorry! One can argue that encapsulation (IS-A) opposes composition (HAS-A), and considering that React is build on the principles of composition, the Compound Component pattern is actually an antipattern. The provider pattern, which is basically React’s way to implement dependency injection is also problematic. I hardly imagine advantages of increasing components dependencies from the outside world. One thing for sure, it absolutely doesn’t help with reusability, as now those components require providers in their subtree, in other words they locked in the providers subtree

Igor Snitkin
Igor Snitkin

Responses (3)