【发布时间】:2021-07-09 11:34:41
【问题描述】:
我有一个样式文件
import { makeStyles } from "@material-ui/styles";
export const useStyles = makeStyles((theme) => ({
paperStyle: {
width: 400,
height: 320,
display: "flex",
justifyContent: "center",
alignItems: "center",
[theme.breakpoints.down("xs")]: {
width:200
},
},
animationStyle: {
width: "90%",
height: "90%",
},
}));
我觉得一切都是正确的,我不明白为什么这会给我这个错误?我哪里错了? material-ui 的 Alpha 版本有什么变化吗?请帮忙。
这是CodeSandbox的链接
【问题讨论】:
-
好吧,
theme.breakpoints是未定义的。你可以做一个 if 检查快速修复 -
theme.breakpoints没有问题,问题出在down。 -
我删除了
down('xs'),没有错误。 -
使用 import { makeStyles } from "@material-ui/core/styles";
标签: reactjs material-ui