如何从 MUI v4 重构到 MUI v5。

huangapple go评论45阅读模式
英文:

How to refactor from mui v4 to mui v5

问题

我有以下的样式类,我想在其中使用媒体查询,但我得到了以下错误:

react-dom.development.js:67 警告:不支持的样式属性 @media (max-width: 550px)。你是不是想说 @media (maxWidth: 550px)?

mui v5 中实现类似的查询解决方案的正确方法是什么?

英文:

I have the following style class that I want to use media query on but I am getting the following error:

> react-dom.development.js:67 Warning: Unsupported style property @media (max-width: 550px). Did you mean @media (maxWidth: 550px)?

iconFolder: {
    fontSize: 45,
    // IPHONE 5/SE
    ['@media (max-width: 550px)']: {
        fontSize: 30,
    },
},

What is the right way to implement similar query solution but in mui v5 ?

答案1

得分: 1

'@media (max-width: 550px)': {
fontSize: 30,
},

英文:

Try like this:

'@media (max-width: 550px)': {
  fontSize: 30,
},

huangapple
  • 本文由 发表于 2023年5月18日 02:53:09
  • 转载请务必保留本文链接:https://go.coder-hub.com/76275364.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定