[英]Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object
I seem to be having a problem with this module that was exported in the correct manner but when it is imported and i get the error that was stated above.我似乎遇到了这个以正确方式导出的模块的问题,但是当它被导入时,我得到了上面提到的错误。 can anyone help?
有人可以帮忙吗? anything is appreciated Here is the code of the module
任何东西都值得赞赏这是模块的代码
import React from "react";
import { makeStyles } from "@material-ui/core/styles";
import Typography from "material-ui/styles/typography";
const useStyles = makeStyles(theme => ({
maindiv: {
float: 'left',
},
}));
export default function Home() {
console.log("inside the function");
const classes = useStyles();
return (
<div className={classes.maindiv}>
<Typography variant="h5">this is it</Typography>
</div>
);
}
Your 'Typography' import is wrong.您的“排版”导入是错误的。 Use import {Typography} from '@material-ui/core';
使用 import {Typography} from '@material-ui/core'; instead of import Typography from "material-ui/styles/typography";
而不是从“material-ui/styles/typography”导入排版;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.