Compound Components là pattern cho phép các component liên quan chia sẻ state ngầm qua Context.
Ví dụ: <Select>, <Select.Option> chia sẻ state selected value mà không cần props drilling. Pattern này tạo API linh hoạt, cho phép user sắp xếp sub-components theo ý muốn trong khi vẫn duy trì shared state.
Compound Components is a pattern where related components implicitly share state through Context.
- For example,
<Select>and<Select.Option>share the selected value state without prop drilling. - The pattern creates a flexible API that lets consumers arrange sub-components however they like while the shared state is maintained behind the scenes.