Avoiding deeply nested component trees – Ruben Oostinga – Medium.com

If you’re a ReactJS developer, I highly recommend Ruben’s article, which you can find here.

I appreciate Ruben’s insights into how to improve React components’ compliance with the single-responsibility principle, one of the pillars of good object-oriented design. As Ruben points out, passing data down through multiple parent components — in order to give it to a relevant child component — can result in noisy applications and components with multiple responsibilities.

The solution, Ruben proposes, is to pass child components, not data. This enables one to create container components whose sole charge is to display their own data in the view.

Reusable, readable and clean — I’m a fan!

 


Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s