Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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",

Link for the component which i am using

like image 357
Muhammad Muzamil Avatar asked Feb 26 '20 10:02

Muhammad Muzamil


Video Answer


3 Answers

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.

like image 159
Ryan Cogswell Avatar answered Oct 28 '22 16:10

Ryan Cogswell


missing some path

Your import statement should be

import useControlled from '@material-ui/core/utils/useControlled'

There is no index file in utils.

like image 41
Joe Lloyd Avatar answered Oct 28 '22 14:10

Joe Lloyd


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";
like image 2
Elham Kohestani Avatar answered Oct 28 '22 15:10

Elham Kohestani