3 ms·
Styled-components has been a godsend, especially in apps that I'm working on with others. You really don't need nested selectors in most cases, since you're ra
by d3sandoval 8y ago
Styled-components has been a godsend, especially in apps that I'm working on with others.
You really don't need nested selectors in most cases, since you're rarely thinking about the page context when dealing with a single react component.
Styled components does namespacing for you and it's easy to share styles, colors, etc. across components for reusability (a la mix-ins) and portability via the props abstraction.
- qudat 8y agoI'm going to echo styled-components being a godsend. I've built a ton of front-end applications, both pre- and post-react. I've tried a ton of implementations of CSS, including just using PostCSS. After all my time investigating the best way to approach CSS, I think style-components is the best solution to use with React.
- aggronn 8y agostyled-components is what got me to switch from LESS to css-in-js, and I'm so grateful. Anyone interested learning about css-in-js for the first time would benefit from understanding the styled-components model, but there's already churn in that category, and new libraries inspired by styled-components that take it further. Here's an interesting perspective on the history of CSS-in-JS: https://github.com/streamich/freestyler/blob/master/docs/en/generations.md https://github.com/streamich/freestyler/blob/master/docs/en/... Currently i'm working with Emotion (https://github.com/emotion-js/emotion https://github.com/emotion-js/emotion) and enjoying it
- mosdl 8y ago5 generations to make something that is less efficient (slow build times, caching not always possible) that straight up css processors. Its kinda sad really (but hey my css is in my js file now, so useful).
- cutler 8y agoYes, notice the trend: web develeoper > Javascript developer > React developer. Soon we'll have CSS developer as a career in itself.
- jen729w 8y agoGiven that I, as a n00b, find JS – hell, even React – way simpler to master than CSS, that wouldn’t surprise me at all. I don’t mean the syntax, of course. The syntax is trivially simple. Translating that to something that looks good and is laid out just as you want, oh boy. CSS is by far the element of front-end development that I’m enjoying the least.