【问题标题】:Typescript TS2604: JSX element type 'Drawer' does not have any construct or call signaturesTypescript TS2604:JSX 元素类型“抽屉”没有任何构造或调用签名
【发布时间】:2019-06-06 04:57:44
【问题描述】:

我已经尝试过在 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>
                )
            }
        }

【问题讨论】:

  • 你想做什么?你能在 stakcblitz 中创建演示吗?

标签: reactjs typescript


【解决方案1】:

如下更改您的导入可能会对您有所帮助:

import { Drawer } from "@material-ui/core";

【讨论】:

    猜你喜欢
    • 2018-02-15
    • 1970-01-01
    • 2018-07-13
    • 1970-01-01
    • 2021-07-10
    • 2019-04-26
    • 2021-11-30
    • 2016-10-07
    • 2016-03-05
    相关资源
    最近更新 更多