[英]./src/components/styles.js Attempted import error: '@material-ui/core/styles' does not contain a default export (imported as 'makeStyles')
I get我得到
./src/components/styles.js Attempted import error: '@material-ui/core/styles' does not contain a default export (imported as 'makeStyles'). ./src/components/styles.js 尝试导入错误:“@material-ui/core/styles”不包含默认导出(作为“makeStyles”导入)。
when I try to run my react app.当我尝试运行我的 React 应用程序时。 How would I resolve this?
我将如何解决这个问题?
Here are the contents of styles.js for reference:下面是styles.js的内容供参考:
import makeStyles from "@material-ui/core/styles";从“@material-ui/core/styles”导入makeStyles;
export default makeStyles(()=>({ ul:{ justifyContent: "space-around", }, }));导出默认 makeStyles(()=>({ ul:{ justifyContent: "space-around", }, }));
You need to use a named import like this:您需要使用这样的命名导入:
import {makeStyles} from "@material-ui/core/styles"
or a default import like so,或像这样的默认导入,
import makeStyles from "@material-ui/core/styles/makeStyles"
You're in the middle of the two.你介于两者之间。
https://material-ui.com/guides/minimizing-bundle-size/#development-environment is good to read up on. https://material-ui.com/guides/minimizing-bundle-size/#development-environment很好读。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.