问题描述
目前我有这个:
const ButtonStyles = {
color: 'red',}
const ButtonStyles = {
color: 'red','@media (max-width: 900px)': {
color: 'blue',}
}
如果语法不是这种格式,那应该怎么做?
解决方法
根据此discussion,您不能将媒体查询与 react css 对象一起使用。您必须使用带有类名或其他外部模块(如样式组件)的样式表。