【问题标题】:Attempted import error: 'ImageList' is not exported from '@material-ui/core'尝试导入错误:“ImageList”未从“@material-ui/core”导出
【发布时间】:2021-10-17 05:46:21
【问题描述】:

您好,我正在开发一个 react 应用程序,我正在尝试从 @material-ui 导入 ImageList 我使用 "import { ImageList } from '@material-ui/core'; but it gives me error while compiling , i 've installed npm install @material-ui/core` 这是我的依赖项 "@material-ui/core": "^4.11.4", “反应”:“^17.0.2”, “反应域”:“^17.0.2”

【问题讨论】:

    标签: reactjs npm installation material-ui


    【解决方案1】:

    ImageList 组件仅在 material-ui v5 中可用(目前为 alpha)。

    npm install @material-ui/core 安装最后一个稳定版本(v4.11.1)

    对于 alpha 版本,您应该使用以下命令 install @material-ui/core@next @emotion/react @emotion/styled,如官方文档 https://next.material-ui.com/ 中所述

    【讨论】:

      【解决方案2】:

      确保您使用的是材质 ui 5。在材质 ui 4 中,您必须使用 GridList 而不是 ImageList

      【讨论】:

        猜你喜欢
        • 2021-03-19
        • 2021-09-11
        • 1970-01-01
        • 2021-09-05
        • 2021-09-23
        • 2021-01-24
        • 2020-07-16
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多