‘LeftMenu‘ cannot be used as a JSX component.
程序员文章站
2022-05-26 17:55:45
...
最近刚开始学习react,编写完类组件,使用时发现报错,错误如下:
TS2786: 'LeftMenu' cannot be used as a JSX component.
Its instance type 'LeftMenu' is not a valid JSX element.
Type 'LeftMenu' is missing the following properties from type 'ElementClass': context, setState, forceUpdate, props, and 2 more.
直接在描述文件(styled.d.ts) 添加
export class ReactElement<T> {
}
问题解决!