Unfold the given component into a component per member of the given union,
where the given prop of each component is partially applied to a different
member of the union.
const [ GreenLabel, YellowLabel, RedLabel ] = unfoldProp( BaseLabel, // Base component. 'color', // Prop that we will be setting. )( ['green', 'yellow', 'red'], // Array of union members. String.capitalize, // Optional function will be used to compute // variant displayName from its `color` prop. )
Unfold the given component into a component per member of the given union, where the given prop of each component is partially applied to a different member of the union.
This code:
Can be rewritten using
unfoldProp
as: