withDefaults withFactory withOverride withOverrides
function CardWithIcon({ content, icon }: {
content: string;
icon: "star" | "heart" | ...;
}) {
return <>...</>
}
const StandardCard = withDefault("icon", "star")(CardWithIcon);
<StandardCard content="some content" />
// is equivalent to
<CardWithIcon icon="star" content="some content" />
// but
<StandardCard content="some content" icon="heart" />
// is equivalent to
<CardWithIcon content="some content" icon="heart" /> // it propagates the new value
Generated using TypeDoc
adds default value to a prop, so it can still receive a value but it now has a default one