Learn Vanilla JS
(No, it’s not another framework.)
Why should you learn vanilla JS?
There are so many powerful libraries and frameworks available. Why bother learning vanilla JS?
- It’s better for web performance.
- It provides a simpler developer experience.
- If you do want to still use frameworks, it makes working with them easier.
Let’s unpack each of these a bit.
1. It’s better for web performance
That 30kb of React or Vue doesn’t seem like much, especially in age of high-speed internet. But not everyone has 5G LTE, wired broadband, or the latest devices.
Which has a better First Meaningful Paint time?
- a raw 8.5MB HTML file with the full text of every single one of my 27,506 tweets
- a client rendered React site with exactly one tweet on it
(Spoiler: @____lighthouse reports 8.5MB of HTML wins by about 200ms)
2. It provides a simpler developer experience.
The modern developer experience sucks.
Imagine if you could just open up a text editor and a browser and start coding. No terminal window. No
npm install. No build and compile steps. No webpack.
Just you and the code.
You can add more tooling to vanilla JS if you want. Sometimes it’s helpful, particularly on larger projects or when working with teams. But the baseline, the barrier to entry, is so much lower.
A text editor and a browser. That’s it.
3. If you do want to still use frameworks, it makes working with them easier.
Getting started with frameworks is hard. There’s a lot of assumed knowledge in the documentation.
Understanding how these tools work under-the-hood makes them easier to learn. Understanding what the browser can do for you natively helps you write better code with framework.
A lot of people try to learn a framework, get stuck, and quit to focus on fundamental vanilla JS.
Once they feel comfortable, they go back to the frameworks, and find them a lot easier to learn.
How to learn vanilla JS
- Daily Developer Tips. I send out a short email each weekday with code snippets, tools, techniques, and interesting stuff from around the web.
Hi, I'm Chris Ferdinandi. 👋
Get Daily Developer Tips
I send out a short email each weekday with code snippets, tools, techniques, and interesting stuff from around the web. Join 9,200+ daily subscribers.