DEV Community

Discussion on: Should I start by learning vanilla Javascript or a framework?

Collapse
 
jeremycmorgan profile image
Jeremy Morgan • Edited

Story time!

I worked on a project last year with unique challenges. The short description is: it was a Web API "hub" with many terminals coming off of it. We packaged up entire webpages and sent them down to the clients, which would then send REST commands back to the hub and work. Think old school Client/Server architecture (Though this was about a year ago lol).

Everything that ran in the browser had to be downloaded. Every. Single. File. had to be put into a byte stream and sent.

Size was everything here, and it needed to be fast, and work with poor network connections.

When I started on the project we were using jQuery and Angular. It was minified and sent over the wire on each connection to the hub. Connects and disconnects happened frequently. It was too slow and there was too much traffic being sent over the network.

I ended up refactoring the application with vanilla JavaScript and cut the size down to a minuscule fraction of what it was. I swapped out the jquery stuff with vanilla JS and built a smart framework for it so we didn't need Angular. It ended up being all pure JS. This improved performance greatly. Kilobytes instead of Megabytes.

The point of my rambling here is: There is a place for jQuery (even in 2019) and there's a place for Angular/React/Vue etc. However:

Having the ability to swap things out with Vanilla JS and do the same thing if needed is a very powerful skill to have in your toolbox.

There are times when re-writing everything in JS is a terrible call. You could be just reinventing the wheel and creating catastrophic problems. There are also times when it's a really elegant way to make a system better.