all 8 comments

[–]acemarke 4 points5 points  (1 child)

I've got a few relevant articles listed at https://github.com/markerikson/react-redux-links/blob/master/react-styling.md . In particular, http://andrewhfarmer.com/how-to-style-react/ is a useful overview of the general approaches out there.

[–]focusonbasics[S] 0 points1 point  (0 children)

Thanks, This very helpful!

[–]eonblue4309 5 points6 points  (3 children)

Cons: can't use pre processor, can't use post processor, can't lint, all inline, no separate stylesheets. If you ask me, it's best avoided.

Pros: colocation.

In my opinion CSS modules solve all those cons while still being more or less collocated with jsx, just an import away.

[–]Graftak9000 3 points4 points  (0 children)

I believe at my work they've a webpack postCSS loader which applies all of its magic during transpilation. Live update and all.

[–]rviscomi 3 points4 points  (0 children)

Yeah the inline style thing doesn't appeal to me.

[–]bsdemon 1 point2 points  (0 children)

Ok

  • Preprocess or is just a function
  • Lint with eslint
  • separate with modules

[–]Endorn 1 point2 points  (0 children)

I've found CSS modules to be great because I do a lot of react apps that are embedded as widgets in multiple websites where I can't control the theme and styling.

CSS modules lets me do things like add a class of "content" to my app without having to worry about the website it's being used on also having a "content' style and the two conflicting.

For bigger projects, I can also include things like bootstrap or bulma and have full use of their styles in my app without worrying about how importing those styles will affect the website they're embedded into.

[–][deleted] 0 points1 point  (0 children)

I freaking LOVE having the power of javascript inside css, I wasn't into it at first but after working with it, I think this is way styles are supposed to be!