【发布时间】:2021-01-28 08:09:42
【问题描述】:
假设我有这个:
const Child = styled.button`
background-color: grey;
`;
<div className="some-non-styled-class">
<Child>Hello World</Child>
</div>;
<div className="some-other-non-styled-class">
<Child>Hello World</Child>
</div>;
如何设置 Child 的样式,使其在 some-non-styled-class 下为“红色”,在 some-other-non-styled-class 下为“蓝色”?
我知道ability to refer to other styled-components,但我有一个用例,我需要根据具有静态类名的现有库更改样式。
【问题讨论】: