用js写一个内联样式,
const styles = {
background: 'blue',
color: 'white'
}
并在 JSX 中使用它,如下所示
<div style={styles}> I am a div </div>
使用“样式化组件”编写样式,
const Div= styled.div`
background: 'blue',
color: 'white'
`
并像使用它一样,
<Div> I am a Div </Div>
这里使用 css-in-js 库和使用内联样式有什么区别。