Search⌘ K
AI Features

What are Compound Components?

Explore the compound components pattern in React. Understand how parent and child components are interdependent, with the parent managing state and behavior, enabling you to design cohesive and reusable component APIs. This lesson clarifies the concept using examples like the select and option elements.

We'll cover the following...

Introduction

The first pattern we will consider is called the Compound Components pattern. I know it sounds fancy, but I’ll break it down.

The keyword in the pattern’s name is the word Compound.

Literally, the word compound refers to ...