advanced-react-patterns-ultrasimplified icon indicating copy to clipboard operation
advanced-react-patterns-ultrasimplified copied to clipboard

#3 Compound Components

Open ohansemmanuel opened this issue 6 years ago • 0 comments

What is this PR about? 🤔

An API change with the Compound components pattern implemented.

Changes 🎁

  • [x] Create a context object to share state with all child components

Before/After 📸

https://advanced-react-patterns-ultrasimplified.netlify.com/compound-components

Other comments 💬

The usage of the component now changes to:

<MediumClap>
      <MediumClap.Icon />
      <MediumClap.Total />
      <MediumClap.Count />
</MediumClap>

Improvements may include:

  • Exposing child component props for UI customization

Next PR 👉Compound Component with Callback

ohansemmanuel avatar Oct 28 '19 03:10 ohansemmanuel