最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

reactjs - How to pass component to another component with specific properties? - Stack Overflow

programmeradmin6浏览0评论

I'm using in my project library react-icons to provide some standard icons (mostly Material Design ones).

Sometimes I need to pass an icon to a compoment and then override some properties, for instance (pseudocode):

type MyComponentProps = {
    icon: (?)
}

function MyComponent({ icon } : MyComponentProps) {

    return (
        <icon size={20} className="inline-block" />
    )
}

Is it possible? How should I declare the props type to make it possible?

发布评论

评论列表(0)

  1. 暂无评论