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

Fill in your details below or click an icon to log in:

WordPress.com Logo

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

Google photo

You are commenting using your Google 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