[英]Attempted import error: 'useControlled' is not exported from '@material-ui/core/utils'
./node_modules/@material-ui/lab/esm/useAutocomplete/useAutocomplete.js
Attempted import error: 'useControlled' is not exported from '@material-ui/core/utils'.
Facing this issue , how to fix ?面对这个问题,如何解决?
corresponding versions对应版本
"@material-ui/core": "^4.8.3",
"@material-ui/lab": "^4.0.0-alpha.44",
You're using the latest version of the lab, but an older version of core.您使用的是最新版本的实验室,但使用的是旧版本的核心。 Switch to 4.9.4 for core and it should be fine.
内核切换到 4.9.4 应该没问题。
Your import statement should be您的导入语句应该是
import useControlled from '@material-ui/core/utils/useControlled'
There is no index file in utils. utils 中没有索引文件。
Changing the the version of the packages didn't work for me.更改软件包的版本对我不起作用。 The issue was with the refrencing path in the import statement.
问题在于导入语句中的引用路径。
replace代替
import Autocomplete from "@material-ui/lab";
with和
import Autocomplete from "@material-ui/lab/Autocomplete";
try updating @material-ui/core by running尝试通过运行更新 @material-ui/core
npm update更新
这可能对您有用:
import { useControlled } from '@mui/material';
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.