reactjs - Typescript TS2604:JSX 元素类型“抽屉”没有任何构造或调用签名
问题描述
我已经尝试过在 stackoverflow 中找到的其他解决方案,但是我错了,因为没有人为我工作。
有人可以帮助纠正这个 ts 错误吗?
错误 TS2604:JSX 元素类型“抽屉”没有任何构造或调用签名。
所有测试都失败
带功能
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";
推荐阅读
- android - 在 Android Studio 中使用来自 SQLite 的数据填充 ExpandableListView
- javascript - 停止额外的间隔
- python - 如何处理 ML 分类中的字符串数据
- python-multiprocessing - python3中multiprocessing.Lock的共享字典
- javascript - setTimeout 在 iOS 中立即调用,同时启用模态视图,因此模态不会出现
- python - Tkinter Canvas.create_oval 不更新颜色
- perl - 通过 perl 更新查询时出现解析错误
- python - keras, scikit-learn, python, 二元分类混淆矩阵(我可能有bug)
- javascript - JavaScript RegEx 不以 (.js|.jsx|.scss) 结尾
- android - java.lang.OutOfMemoryError:无法分配 7144212 字节分配,其中 4194304 字节和 4MB 直到 OOM