gpt4 book ai didi

reactjs - Material 界面 : useStyles (makeStyles) has lower priority after migration to version 5

转载 作者:行者123 更新时间:2023-12-04 13:24:46 28 4
gpt4 key购买 nike

当我迁移到 Material Ui 的第 5 版时,我所有的样式都开始在样式中具有较低的优先级

const useStyles = makeStyles((theme) => ({
drawer: {
[theme.breakpoints.down('md')]: {
width: 0,
}
},
drawerPaper: {
background: theme.palette.primary.main,
width: drawerWidth,
},
}))

最佳答案

基于 documention :

@mui/styles is the legacy styling solution for MUI. It isdeprecated in v5. It depends on JSS as a styling solution, which is not used in the @mui/material anymore.


注意:@mui/styles与 React.StrictMode 或 React 18 不兼容。
取而代之的是,您可以使用 The sx prop 哪一个:

is a shortcut for defining custom style that has access to the theme.


styled() :

Utility for creating styled components.

关于reactjs - Material 界面 : useStyles (makeStyles) has lower priority after migration to version 5,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69234190/

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