News for hackers. Stuff that matters.
Re:React JS Best Practices by nulltype on Saturday May 09, 2015 @01:49AM (#9515662)
In the article you say you "Reuse through React instead of CSS" and that you have CSS files for the components and no global CSS classes. Do you mean that the CSS files are applied to the elements as inline styles by react, or just that each component has its own CSS so it's not really "global"?
Re:React JS Best Practices by lopatin on Saturday May 09, 2015 @02:02AM (#9515684)
The latter. Most of our components have an associated scss file. I didn't consider those to be global because we namespace all css rules in the style files under a class name of the same name as the component. But that's a great point, it didn't occur to me that that paragraph may have only made sense to people familiar with our conventions.
Re:React JS Best Practices by rattray on Saturday May 09, 2015 @03:36AM (#9515804)
Interesting. Asking out of curiosity, not skepticism: why not use react styles in js directly, à la vjeux et al?

Reasons I'd guess: not being able to use pseudo-selectors and things like :hover; familiarity for designers; easier use of legacy code; benefits of SCSS that would take work to re-implement in js. But I'm curious what your real reasons were!

Re:React JS Best Practices by lopatin on Saturday May 09, 2015 @08:35AM (#9516194)
That's pretty much it! Although the ideas presented here do make sense (https://speakerdeck.com/vjeux/react-css-in-js) we haven't gotten there yet. Our css namespacing scheme solves the "global namespace" issue, which was the biggest issue that stood out for us.
Re:React JS Best Practices by nulltype on Saturday May 09, 2015 @02:32PM (#9517227)
I like the vjeux thing, I think for dynamic sites if we replace static html and css with javascript the world will be a better place.