Hacker News new | ask | show | jobs
by ojosilva 3130 days ago
Ive started with React recently and strangely the lack of fragments were one of the things that caught my attention in the first days.

Another thing I'm looking for in React as I get started is better styling support. I'm resourcing to React JSS for that, but I feel it should be part of the language. The web trinity if you may is HTML-CSS-JS and React basically left CSS out half-baked into almost unusable style attributes, so I still have to resource to className and CSS. Or am I just being noob-anal?

3 comments

I've found styled components to be a nice attempt at bundling styles with the component. Haven't tried that many options though.

It has out of the box support in Atom and scss (like?) syntax.

https://github.com/styled-components/styled-components

I agree with you that CSS support is a bit lacking. I think they did this on purpose though, because many people prefer CSS preprocessors like SCSS/Sass or Less. However, with Create React App, you get nice CSS support via webpack and PostCSS. I recommend you check out styled-components; getting used to the back tick syntax takes some time, but after you do get used to it, working with them is really nice. Also, Babel syntax highlighting (in Atom at least) properly highlights the CSS used in styled-component.
Another vote for styled-components. I tried everything I could (model and library wise). That's the one that felt the most natural to me.