Comments (4)
I'm interested too learn about that too :-) But jss
shows you can also manage stylesheets, not just inline-styles from javascript.
@gaearon
what do you think about jss
and/or css-modules
in combination with things like hyperstyles
from ama.
+1 :)
from ama.
+1:)
from ama.
It's hard to say! I don't have a clear preference right now because I haven't worked on a product for almost half a year, and we were just barely starting to sometimes use inline styles when I left, so I haven't really played with these solutions enough.
I think, code-wise, I prefer the inline styles model. It doesn't need to correspond to inline styles in the implementation: for example jsxstyle treats CSS as an implementation detail, and it works as inline styles in development, but can be extracted into a CSS bundle in production thanks to static analysis. Using static analysis for this is appealing to me because it lets you write code using a single language (JS), but still perform tasks like auto-prefixing, optimization and dead-code elimination at the compile time.
There are, however, tradeoffs and inconveniences you already know: editing or debugging inline styles in browser isn't very nice, it's harder to do CSS animations or media queries. I think, as we get better JavaScript APIs for these things, and more frameworks start adopting React's declarative rendering model, inline styles (or, really, specify-as-inline-styles-but-compile-to-whatever) solutions will become mainstream. In the meantime, CSS modules strike a pretty good balance between the benefits of style isolation and the incidental complexity introduced by many inline style tools. But I'm also looking forward to more tools like jsxstyle.
from ama.
Related Issues (20)
- What are the most popular IDEs among React developers at Facebook?
- Which product metrics does React have?
- What skills have made the biggest impact on your programming?
- Google Analytics && extending setState in the class
- React-Native support in 2018 later
- CRA + Monorepo + Lerna + Yarn HOT 3
- Help me to find a right way HOT 2
- Curious what keyboard and mouse you use
- react-testing-library Integration Tests HOT 1
- What Computer Science concepts do you know?
- How did you get a UK Work Visa without a degree.
- What does "gaeron" mean? HOT 2
- Single source of truth and Redux
- Concurrent mode in react
- Building performant forms in React over a hundred fields HOT 1
- About your earnings.
- The webpack adds an unnecessary file to the chunk HOT 1
- component variables access inside hooks. HOT 1
- react-fast-refresh from scratch
- Do you meditate?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ama.