CSS-in-JS is the new and popular kid on the block. On the flipside, Vanilla CSS is old-school and isn’t so much of the hi-roller anymore. Actually, CSS was never liked too much by many anyway.
Whenever I read articles explaining why CSS-in-JS is better than CSS, I can’t help but think it’s mainly due to a lack of understanding or experience. That’s not a bad thing per se, since not everyone is made to know and understand everything, but using one technology to avoid another, maybe isn’t a good solution.
Many arguments why CSS is “bad” can be understood. CSS for sure isn’t perfect and definitely has its flaws. One of the common problem seems to be large teams with different skill levels working on the same CSS codebase and causing accidental overwrites, because scoping can’t be easily controlled. For these overwrites, I’d argue that it’s probably down to experience and the skill level with CSS, but then again, we hit the issue of large teams with different skill levels. Don’t get me wrong, even skilled people in smaller teams create bugs by overriding existing rules. Guilty as charged. CSS is hard and naming things even more so. Bugs and mistakes are part of the game, just like there are bugs in other languages, too.
Don’t worry, I’m not writing this to explain what is better and what’s not. I have been working on the web long enough to know that in some time, things will be different again and we will argue about new problems and different tools. This isn’t the first iteration of A vs B vs C to then suddenly see D emerge and all others be forgotten.
With all of these discussions, I’m missing an important part of understanding and creativity though. Which I see like this:
The internet is an ongoing experiment, it’s so young and many things aren’t set in stone, nor confirmed to be working forever. Nobody knows where, and with what we will end up in 10 years time from now.
Many of these discussions often seem absolute. Framework A is the latest and greatest and that’s why everyone should use it. For everything! Many people seem to forget:
There are lots of different use cases, different projects, different people and different skillsets. We have different requirements and different budgets, different timelines and different needs.
And guess what: There’s not a single solution for all of these. There’s no one-size-fits-all tool or technology. And why should there be?
Pushing for the future
Web standards do work great and are introduced to be the building blocks of the web. New frameworks emerge and start to push things in new directions. These are all experiments, trying to solve a certain problem, every single one of them in their very own way. I applaud everyone who does venture into these lands, because this is how things evolve. We need these experiments to happen, because they are the ones driving innovation. We’ve seen some great things come from such experiments and they have had huge impacts on the web and the ways of how we work today.
Some things make it, some others don’t. Some things become a standard and some others will be discarded. CSS-in-JS for example is a first stab at doing things differently and to solve a problem that we’ve seen. Maybe it‘ll work or maybe it won’t. As with every version 1.0, don’t get too hyped up. The important thing to remember is that whatever it turns into, will have pushed the boundaries of what is possible and will have provided insights on what works well and what hasn’t.
Everything we do is a work in progress and nobody really knows where things will go. It’s all a bit of trial and error. Some things will work, others won’t. Some of the things that we try will be great and for others we will realise it’s been a bad idea in the first place. From both experiences we will learn for the future though.
I wish we would allow a little more flexibility and creativity for things like these to flourish, fail or make it. Preaching for absolutism after just a few weeks time1 after the release of a new tool is clearly not the best way to go about things. And while there are many different (and valid!) opinions out there, I don’t understand why some people get so worked up about these things.
Remember: Everyone is free to choose the technology they like. Using only the latest and greatest things does not make you a better person. Nor does it make you a better or worse developer. But being kind, creative and open for constructive, creative and challenging conversations to push things forward will. In the end we’re all calling for diversity and and besides different people, different tools and opinions is what makes the web. The web is large enough for many different things to co-exist, whether that’s opinions or a tech stack. We should take this amazing opportunity in front of us, learn from each other by not trying to create from and for different systems, not a single one, just because someone said so. And while we’re at it, we should treat each other with kindness, no matter the opinions.
1: Of course this timeframe is highly exaggerated, but hopefully you’ll get the idea