gpt4 book ai didi

reactjs - 无法在 ReactJS 中导入表容器 - Material UI

转载 作者:行者123 更新时间:2023-12-04 10:52:01 25 4
gpt4 key购买 nike

我正在尝试创建一个表组件,但无法从 material-ui 导入 TableContainer 组件:

Attempted import error: 'TableContainer' is not exported from '@material-ui/core'.

我需要它在页面顶部是这样的:
import React from 'react';
import { makeStyles } from '@material-ui/core/styles';
import { TableRow, TableHead, TableContainer, TableCell, TableBody, Table, Paper } from '@material-ui/core';

这是我的 package.json ,我也尝试过 npm install && npm update 。
{
"name": "link_validator",
"version": "0.1.0",
"private": true,
"dependencies": {
"@material-ui/core": "^4.8.0",
"@material-ui/icons": "^4.5.1",
"@material-ui/styles": "^4.7.1",
"@material/button": "^4.0.0",
"react": "^16.12.0",
"react-dom": "^16.12.0",
"react-redux": "^7.1.3",
"react-scripts": "^3.3.0",
"redux": "^4.0.4",
"styled-components": "^4.4.1",
"typescript": "^3.7.4"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}

最佳答案

正如@AtinSingh 建议我尝试 npm uninstall 并再次安装,将最新写入 package.json + 导入而不解构,它奏效了。

关于reactjs - 无法在 ReactJS 中导入表容器 - Material UI,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59435253/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com