【发布时间】:2019-04-22 09:10:50
【问题描述】:
我正在创建一个带有动态级标题的自定义组件:
const HeadingTag = `h${headingLevel}`;
...
<HeadingTag className='heading'>
{headingText}
</HeadingTag>
但是,我收到以下错误:
error TS2322: Type '{ children: string; className: string; }' is not assignable to type 'IntrinsicAttributes'.
Property 'children' does not exist on type 'IntrinsicAttributes'.
如何将默认 HTML 属性传递给解析为默认 HTML 标签的自定义标签?
【问题讨论】:
标签: reactjs typescript jsx