Skip to content

Instantly share code, notes, and snippets.

@mgaebler
Last active April 7, 2020 07:26
Show Gist options
  • Save mgaebler/3b365c2f8ddb0331960a3f138a5a25a8 to your computer and use it in GitHub Desktop.
Save mgaebler/3b365c2f8ddb0331960a3f138a5a25a8 to your computer and use it in GitHub Desktop.
ReactProgrammingPatterns

Compound Components

What are compound components?

Compound components is a pattern in which components are used together such that they share an implicit state that let’s them communicate with each other in the background.

Think of compound components like the and elements in HTML. Apart they don’t do too much, but together they allow you to create the complete experience. — Kent C. Dodds When you click on an option, select knows which option you clicked. Like select and option, the components share the state on their own, you don’t have to explicitly configure them. Source: https://blog.logrocket.com/guide-to-react-compound-components-9c4b3eb482e9/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment