The React Pattern You Never Heard of That You Should Be Using
<p>I’m going to show you how to make your React codebase more flexible and less complex by leveraging a little known pattern for React components: <strong>The Compound Components pattern.</strong></p>
<p>Implementing the Compound Components pattern gives you the ability to create components that can be reused in different ways, without adding lots of <code>if else</code> statements.</p>
<p>This will make your code easier to maintain and understand and maybe even impress your team mates.</p>
<p>Unfortunately, most developers don’t know this pattern exists!</p>
<p><strong>Step 1: Understand What Compound Components Are</strong></p>
<p>The first step is recognizing what Compound Components are and their value.</p>
<p>The Compound Components pattern is a design pattern in which components are used together so they can share state, allowing them to communicate with each other but are loosely coupled. One of its hallmarks is the use of static properties on a component. Basically dot notation for accessing nested components.</p>
<p><a href="https://brianjenney.medium.com/the-react-pattern-you-never-heard-of-that-you-should-be-using-5e92c2cfc1dd">Website</a></p>