【发布时间】:2019-11-08 04:22:00
【问题描述】:
当使用样式化组件时,对于更大的可扩展应用程序来说,什么是更好的方法?为每个 html 标签制作单独的变量,或者只是将 css 嵌套在变量中?
例如:我有以下简单的结构:
ul {
li {
a {
}
}
}
const list = styled.ul`
padding: 0;
li {
padding: 10px 0;
a {
color: black;
}
}
`
或
const list = styled.ul`
padding: 0;
`
const listLi = styled.li`
padding: 10px;
`
const listA = styled.a`
color: #333;
`
【问题讨论】: