-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
I know slots are not officially released, but thought i would share this finding incase you were not already aware. Are there plans to support this pattern?
The below works as expected:
type ButtonProps = {
icon: ReactElement<IconProps>;
};
export const ButtonWithIconElement = ({
icon,
}: ButtonProps) => {
return (
<button>
{icon}
</button>
);
};However, the when using the below pattern slots throw an error
type ButtonProps = {
Icon: ComponentType<IconProps>;
};
export const ButtonWithIconComponent = ({
Icon,
}: ButtonProps) => {
return (
<button>
// our Icon is a component
// its name starts with a capital letter to signal that
// so we can just render it here as any other component
<Icon />
</button>
);
};Metadata
Metadata
Assignees
Labels
No labels