【发布时间】:2020-02-10 09:04:29
【问题描述】:
我喜欢干净的对象风格
const Button = styled.button(
{
color: 'darkorchid'
},
props => ({
fontSize: props.fontSize
})
)
但是模板(?)样式似乎是主界面,它支持的功能比对象样式更多
const Button = styled.button`
color: hotpink;
`
在 StyledComponent 或 Emotion.js 中,css-string(模板)样式是否比对象样式更受青睐(或更具特色或受支持)?
- 编辑
对于一个区别,我知道我认为对象样式无法做到这一点
const dynamicStyle = props =>
css`
color: ${props.color};
`
const Container = styled.div`
${dynamicStyle};
`
【问题讨论】: