0
点赞
收藏
分享

微信扫一扫

react typescript封装函数式组件styled-component

单调先生 2023-02-14 阅读 71


interface IButton {
margin?: boolean;
width?: string;
justify?: JustifyContentProps;
}

const Button = styled.button<IButton>`
.....
`;


interface ILoadButton extends IButton, DOMAttributes<HTMLButtonElement> {
loading?: boolean;
}

export const LoadButton: FC<ILoadButton> = ({
loading,
children,
...props
}) => (
<Button {...props}>
{loading ? <LoadIcon /> : null}
{children}
</Button>
);


举报

相关推荐

0 条评论