withOverride withFactory withDefaults withDefault
function Card({ content, icon, border }: {
content: string;
icon: "star" | "heart" | ...;
border: "none" | "dashed" | ...
}) {
return <>...</>
}
const StandardCard = withOverrides({icon: "star", border: "rounded"})(Card);
<StandardCard content="some content" />
// is equivalent to
<CardWithIcon content="some content" icon="star" border="rounded" />
// and
<StandardCard content="some content" icon="heart" border="dashed" /> // ❌ is a typescript error, but even though
// is equivalent to
<CardWithIcon content="some content" icon="star" border="rounded" />
Generated using TypeDoc
adds values to many props, they can not be override, which means the given values override others