gpt4 book ai didi

reactjs - 类型错误 : Cannot read properties of undefined (reading 'down' )

转载 作者:行者123 更新时间:2023-12-05 01:57:31 24 4
gpt4 key购买 nike

我创建了一个标题菜单。它仍然适用于 Material-UI V4。但我最近更新到 Material-UI V5。但是我有这样的错误:TypeError: Cannot read properties of undefined (reading 'down')

import makeStyles from "@mui/styles/makeStyles";
import { Theme } from "@mui/system";

// NOTE: Styling header bar components

const useStyles = makeStyles((theme: Theme) => ({
title: {
flexGrow: 1,
},
linkStyle: {
textDecoration: "none",
color: "white",
marginLeft: 5,
},
desktopMenuStyle: {
display: "display",

[theme.breakpoints.down("mobile")]: {
display: "none",
},
},
mobileMenuStyle: {
display: "none",

"& .MuiList-root": {
marginTop: 40,
},
[theme.breakpoints.down("laptop")]: {
display: "block",
},
},
}));

I have a error like this

最佳答案

将此代码写入包含您的组件的文件。

1.导入:

import { ThemeProvider } from "@mui/styles";

import { createTheme, responsiveFontSizes } from '@mui/material/styles';
let theme = createTheme();
theme = responsiveFontSizes(theme);
<ThemeProvider theme={theme}>
<your component/>
</ThemeProvider>

关于reactjs - 类型错误 : Cannot read properties of undefined (reading 'down' ),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69237115/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com