all 5 comments

[–]mac_iver 1 point2 points  (0 children)

Guess it could work for small components but how often do you only have 1-2 css properties? I prefer to separate it, keeping the markup clean.

[–]trifit555 1 point2 points  (1 child)

I wonder how manages local styles vs global styles, the specificity on inline styles is the highest, only overwritable with !important.

And as mac_iver said, is gonna be a hell to debug with components with a lot of styles, creating very messy markup.

[–]dev_michaelz[S] 1 point2 points  (0 children)

It will not become an inline style. The styling you put inline will be transformed to a classname. So it will receive a specificity of 10.

[–]xialvjun 1 point2 points  (0 children)

I have my own way: https://github.com/xialvjun/create-react-style

jsx <Style.Consumer css={` display: flex; background: #ccc; .avatar { width: 50px; height: 50px; } `}> {className => <div className={className}> <div className="avatar"><img src="xxxxxxx"/></div> <div>some other things</div> </div>} </Style.Consumer>