在樣式化的組件內(nèi),我們支持所有CSS加嵌套。由于我們生成的是實際的樣式表而不是內(nèi)聯(lián)樣式,因此CSS中的所有工作都可以在樣式組件中使用!
> p {
/* descendant-selectors work as well, but are more of an escape hatch */
text-decoration: underline;
}
/* Contextual selectors work as well */
html.test & {
display: none;
}
`;
render(
<Example>
<p>Hello World!</p>
</Example>
);
&符(和)替換為該樣式化組件的生成的唯一類名,從而使復雜的邏輯變得容易。
更多建議: