DEV Community

No, React didn't kill jQuery

Ben Halpern on May 22, 2020

The following thoughts are not revelatory, just forgotten by some and never explained to others. jQuery, once the library of the web, practically ...
Collapse
 
eaich profile image
Eddie

I agree 100% with this except the "you probably shouldn't use jQuery for a new project." I love that jQuery is a drop-in that can live and work alongside my own abstractions and modules, as opposed to the all-or-nothing approach with adopting a framework.

I still use jQuery for its primary UI widgets - draggable, resizable, sortable.

Collapse
 
ben profile image
Ben Halpern

Yeah, I agree with all of that... Except I still think the downsides of library size still makes the tradeoff not worth it.

This isn't a hill I'd die on, but it's the side of the coin I'd fall on. If I'm going to drop in a convenience lib I'd rather go with something a lot lighter. Of course if you're building desktop software, internal tools, etc—it probably wouldn't be a big concern. But if you're building for the masses I'd try and be stricter on my budget than to immediately reach for jQuery, even if it is slimmer these days than its peak.

Collapse
 
eaich profile image
Eddie • Edited

An ongoing joke I have with some of my dev friends is that we argue and debate over payload sizes and when we're done, we put our headphones on and start streaming Spotify at 320 kbps. Haha.

Fair points. However, comparatively, the size of jQuery is relatively small or on par with other libs. jQuery core is 31.3 KB compressed. Meanwhile, Notion, AirTable and other modern apps have JS payloads of over 7 MB, and they don't have a shortage of users. Depends on the target users.

I'd say that the size alone of the libs shouldn't be the only measurement. We should consider the added benefits of that payload throughout the system to justify its size.

Collapse
 
brandinchiu profile image
Brandin Chiu

You could always use JQueries native tools to build a smaller library with only the components you need if space is a concern (which it definitely should be)

:)

Collapse
 
patarapolw profile image
Pacharapol Withayasakpunt

Yeah, I would only use jQuery for its useful plugins.

Otherwise, I would need to know jQuery for Cheerio. But I rarely need to use cash-dom, for instance.

Collapse
 
andogq profile image
Tom Anderson

I'd go as far to say that jQuery was detremental for me learning JavaScript. I learnt them side by side, and they became synonymous with each other, and I became I credibly reliant for even the most simplest of things.
As a result it took me longer to understand the language. $() was a magical black box that had all the solutions to my problems, but once I peeled back the hood and understood what was happening, I found myself writing cleaner and better code.

Collapse
 
josemunoz profile image
José Muñoz

To be fair at the time JQuery was introduced JS was still quirky and it wasn't updated every few years like it has been since 2015. Those who had to live JS pre-ES6 know that trying to make anything on vanillaJS quickly becomes a pain in the ass. That has changed because JS has become better over the years and the developer culture is shifting away from the imperative model. Developing an app using Vanilla JS is not a feat, but an excersise of inconvenience in today's framework dominated world. just my opinion.

Collapse
 
mkrl profile image
Mikhail Korolev

Getting rid of jQuery-only solutions on the first Google search page of "do X in javascript" is the best thing that happened to the modern web in the last 5 years.

Either way, the standards are rapidly evolving: we are slowly but steadily moving towards the modern Web.
Mark my words, the next great thing to be widely adopted is native modules. The feeling of not having to build your modern client-side code is immeasurable. And it feels good.

Collapse
 
antonmelnyk profile image
Anton Melnyk

jQuery is not that faded away as it might seem. It's a common myth from people who develop modern apps and live in "closed" reality.

Believe it or not, but biggest part of the internet is still PHP and countless e-commerce websites that use and rely heavily on jQuery and its plugins.

So is correct, jQuery wasn't "replaced" by React just because they are orthogonal to each other. While React and other frameworks are hyped and cool guys, the very large part of today's websites is still good old backend templating and jQuery.

Believe me, it's not going anywhere in the nearest future.

Collapse
 
steveblue profile image
Stephen Belovarich • Edited

That’s kind of like saying The Beatles didn’t kill Elvis. 🤔

Collapse
 
codingmindfully profile image
Daragh Byrne

jQuery won me over because it made me not have to think too hard about differences browsers, when they were more of a thing than they are now (web standards and APIs are much more consistent than when jQuery came on the scene). Now any of that murk happens with polyfills etc.

Collapse
 
igorfilippov3 profile image
Ihor Filippov • Edited

Jquery and React are tools for different approaches. React way it is SPA in most cases, while jquery is used when you have most of the logic at server (MVC for example) and want to have a thin client. So comparement of these tools is not valid.

Collapse
 
andrewbrown profile image
Andrew Brown 🇨🇦

JQuery definitely killed Prototype

prototypejs.org/