Last week, Bootstrap launched their latest version (v5 alpha) and one of the new features was that they no longer depend on jQuery, that got me thinking, do we actually need JQuery in 2020?
jQuery is one of the most popular libraries in the world, so popular that it’s used by 75.9% of all the websites. In this article we’ll talk about how it became so widely used, and if it’s still worth learning in 2020.
JQuery was created in 2006, back when Internet Explorer was the most used browser and the web was totally different place than it is now. It solved a lot of problems for front-end developers back then; it provided a simple and clear API to build websites with ease. For example:
- Animations: JQuery provides some easy to use out-of-the-box functions for animating DOM elements, without needing to get messy with CSS.
- AJAX: Making AJAX requests without jQuery was a hassle, but with JQuery you can do it in a couple of lines.
The short answer is no, here's why:
// Solution in jQuery
// What you need to do in pure JS:
So as you can see, jQuery is more replaceable than we used to believe, especially with the emergence of front-end frameworks like React and Vue.
PS: Mixing two frameworks like React and JQuery is a very bad idea.
Amazon famously found that every 100ms of delay in the load time of amazon.com cost them 1% in sales.
So loading an 80KB JQuery is a big problem, a problem we can avoid if we can find lighter alternatives.