Css 默认情况下使用样式化组件!重要的

Css 默认情况下使用样式化组件!重要的,css,reactjs,styled-components,Css,Reactjs,Styled Components,我用样式化的组件包装现有组件,但我发现必须声明很烦人!重要信息以覆盖该组件的现有样式,例如 import { Row, Col, Card, Typography } from 'antd' const { Title } = Typography const StyledTitle = styled(Title)` text-align: center; margin: 50px 0 20px 0 !important; font-weight: normal !importan

我用样式化的组件包装现有组件,但我发现必须声明
很烦人!重要信息
以覆盖该组件的现有样式,例如

import { Row, Col, Card, Typography } from 'antd'
const { Title } = Typography

const StyledTitle = styled(Title)`
  text-align: center;
  margin: 50px 0 20px 0 !important;
  font-weight: normal !important;
`

很难看出哪些属性必须使用重要属性,我在保存文件后通过视觉变化检测到它,这很烦人,解决方法是什么?

他们建议添加符号

const StyledTitle = styled(Title)`
  &&& {
      text-align: center;
      margin: 50px 0 20px 0;
      font-weight: normal;
  }
`

他们建议添加符号

const StyledTitle = styled(Title)`
  &&& {
      text-align: center;
      margin: 50px 0 20px 0;
      font-weight: normal;
  }
`