on()
const Element = createMemo( on( () => props.name, () => { sideeffect(); return IconRegistry[props.name]; }, ), );
createEffect(() => sideeffect(props.name));
<Dynamic component={IconRegistry[props.name]}/>
export type ButtonSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl';export interface ButtonIconProps extends JSX.ButtonHTMLAttributes<HTMLButtonElement> { size?: ButtonSize; icon: IconName; iconclass?: string; variant?: 'text' | 'contained'; active?: boolean; cross?: boolean;}const keys = [ 'iconclass', 'icon', 'active', 'size', 'class', 'children', 'variant', 'active', 'cross',] satisfies (keyof ButtonIconProps)[];const initial = { variant: 'contained', size: 'md' } satisfies Partial<ButtonIconProps>;export const ButtonIcon = (props: ButtonIconProps) => { const [local, $] = splitProps(mergeProps(initial, props), keys); const Cross = createMemo(() => () => { if (local.cross) return ( <Icon size={local.size} class="stroke stroke-accent-8 w-max -rotate-45 absolute pointer-events-none" name="CgBorderStyleSolid" /> ); return null; }); return ( <button ...> <Dynamic component={Cross()} /> ... </button> );};