我已经尝试过其他解决方案在堆栈溢出中查找,但也许我错了什么,因为任何人都不适合我。
有人可以帮助纠正这个ts错误吗?
错误TS2604:JSX元素类型'Drawer'没有任何构造或调用签名。
所有测试都失败了
有功能
import React, {Component} from "react";
import Drawer from "@material-ui/core";
import { Scrollbars } from 'react-custom-scrollbars';
const DrawerB = () => (
<Drawer
open={true}
>
<h1>AAAA</h1>
</Drawer>
);
与班级
class DrawerA extends Component<any, any>{
constructor(props){
super(props)
}
render(){
return (
<Drawer
open={true}
>
<h1>AAAA</h1>
</Drawer>
)
}
}
与类和没有构造
class DrawerC extends Component<any, any>{
render(){
return (
<Drawer
open={true}
>
<h1>AAAA</h1>
</Drawer>
)
}
}
如下更改导入可能对您有所帮助:
import { Drawer } from "@material-ui/core";