【发布时间】:2020-08-02 03:23:45
【问题描述】:
我正在尝试使用模板创建 Web 组件,并且在 TSX 文件中使用 h1 标记时出现以下错误:
[ ERROR ] Missing "h" import for JSX types: ./src/components/side-drawer/side-drawer.tsx:1:19
In order to load accurate JSX types for components, the "h" function must be imported from "@stencil/core"
by each component using JSX. For example: import { Component, h } from '@stencil/core';
下面是我的 web 组件的代码:
import { Component } from "@stencil/core";
@Component({
tag: "vs-test",
})
export class Test {
render() {
return (
<div>
<h1>Hello</h1>
</div>
);
}
}
【问题讨论】:
标签: javascript jsx web-component stenciljs tsx