在样式化组件中使用 ClassName 覆盖类

时间:2021-01-26 14:48:21

标签: css reactjs styled-components jss

如何在没有 !important内联样式 的样式组件中使用 className 属性覆盖 css 类(css 类是从样式组件随机命名的)。 React 版本为:“16.12.0”,样式组件版本为“5.2.1”

const Button = styled.button`
${props => props.theme.button.style}
`
<Button
   css={theme => theme.button.style}
   className={"bertug"}
>
</Button>

我的主题风格是;

const theme = {
button: {
   style: {
      color: "#fff"
   }
 }
}

我的课;

.bertug {
   color: "#000"
}

Dev. Console apperance

0 个答案:

没有答案