Photo by Pawel Czerwinski on Unsplash
Why React
How starting with HTML, CSS, and Javascript helps build gratitude for libraries and frameworks.
In August of 2020, I began my coding bootcamp. I had previously been teaching myself to code and going through some of Codecademy's courses but the bootcamp was what I needed to put all the pieces together.
It took about two days in the bootcamp before hearing about React. I googled React.
Then, came the struggle. This is a continual struggle for myself and many other devs.
It goes like this, 'why do I have to learn all these technologies if React is going to solve this pain? Why wouldn't we just start with React?'
I was and am, more often than I care to admit, naive.
Experiencing Pain
Pain is an interesting thing. Especially when it comes to using coding tools. Pain also exists in marketing. It exists in building products. Pain is why tools and solutions exist.
Most of us experienced this in school too. You learn these long complicated ways of doing math problems and then the teacher shows you the 'better way.'
Most of the time we just sit back and rage and say, "why didn't you start with this!"
This does not apply to this new 'common core' math. I am sure there are many reasons but making what should stay simple more complicated is silly. Comedian Nate Bargatze has a great Netflix special where he talks about common core
👆Sorry for going off topic
The answer? Sometimes there may not have a good answer. But most of the time experiencing the pain builds gratitude, behind a layer of rage, for the tool that solves the problem.
In marketing/business this is something like:
- Pain
- Dreams
- Fix
Or
- Problem
- Agitate
- Intrigue
- Positive Future
- Solution
Ok, ok. But what about React?
When we start with HTML, CSS, and Javascript, eventually we introduce Node (or some other server language). But then writing Javascript for the front end becomes complex and nasty. We pick up a templating language (ejs or something else).
So for frontend stuff things become pretty bloated to add interactivity and events and all sorts of things.
Enter, React.
In my experience, one of the nicest parts of React is it's 'composability'.
Ahhhhh, what is this word. Are we getting into functional programming?! What is happening.
Just chill a bit and think of Lego's.
Lego's?
Yes, legos. When you build with lego's and stack bricks, you are essentially composing pieces together to make something.
Now, to be a little more technical, with React, each 'brick' has some level of functionality ranging from really simple design pieces (buttons, navbars, etc) to full components that house data calls, events, passing data to other smaller components, and so on.
The reason learning all the basic stuff first is really helpful?
Once you begin using React, you start to experience wonders you never knew you wanted.
Someone will say or ask, but what about Svelte, or Vue, or Solid? This, my friend, is not the point.
The point is that no matter which library you jump too or which framework you end up picking up, you have experience the pain of what comes before and can therefore receive the library and framework with gratitude.
Svelte is very nice because all those pesky files you used to have separated can all be in one file. My experience with Vue and Solid are very limited but they still are a welcome relief to common pains experienced.
Components
Aside from composition, declarative components allow your code to be more predictable, understandable, and easier to debug.
There are confusing features of React which I will write about in the future but React, regardless of how many people we may see on twitter rage against it, is in fact a beautiful tool.
As a complete aside, there is also the need to take into account jobs. There are jobs for Vue, Solid, Svelte, and others, but React, as far as frontend javascript jobs go, is very in demand.
So for those trying to break into a career in tech, it makes a lot of sense to include React in the stack of technologies that beginners are learning.
Conclusion
The last thing I'll mention here is that a big piece of React and what makes it a big deal for user interfaces/user experience is 'state management'.
When I write my article on it I will link it here.
I did not cover state management in this article because state management is complex and something deserving of an article all on its own.
My hope is to contribute to making the web, and more specifically javascript ecosystem, more grateful. Why? Because we have an embarrassment of riches when it comes to tooling, libraries, and frameworks.