|
|
|
|
|
by praetorian84
3596 days ago
|
|
I've been using React for a side project for a while. Generally it's been pretty easy to understand the concepts behind it and get productive. A couple of things that have confused/irked me a little: - Having to figure out babel, browserify and/or webpack before you can write hello world isn't a great first experience. I'm glad to see much of this has been moved to a separate page outside of the getting started guide now. - The main React page emphasises that JSX is optional. Even looking at the trivial examples, nesting createElement statements looks horrific. Does anyone use this approach in a large-scale project? If your components are fine-grained enough, perhaps it's passable, but it looks far from ideal. Having used other frameworks, even building up a template in JSX in a return statement feels dirty. I see there are some suggestions around on splitting out JSX, but it would be great if this was the default. - I wasn't really sure what to do with CSS. There's a brief comment on inline-styles at https://facebook.github.io/react/tips/inline-styles.html. For a library for building user interfaces, it seems like this deserves more attention. I would've expected the CSS (styling), javascript (logic and state management) and JSX (layout) to be a little less interwoven. |
|
There are like 3 or 4 different ways of doing it, each with their own pretty big drawbacks.
Personally we ended up using CSS Modules with SASS in our "main" react project, but it feels clunky.
The biggest issue we have is determining which element "owns" the styling. Should a widget style itself, or should it let it's container style it, or should it provide some simple defaults and let the container overwrite them (which gets ugly because with CSS Modules overwriting means using !important or doubling classes (like `.button.button` to overwrite `.button`).
All that being said, it's actually working out really well for us despite feeling wrong. And it might not ever become an issue because our largest stylesheet is like 100 lines long since everything is so compartmentalized.