top | item 39284634

(no title)

TheMajor | 2 years ago

Yup, hard truths: vanilla JS is far less readable and clunkier than just using jQuery to do the same thing. Also, not everyone needs or wants to move to a shadow DOM framework with a zillion components and high complexity. If you're building a SPA or PWA, yes, absolutely, but for the vast majority of us who use a traditional backend/CMS-driven site with server-side rendering where client-side interactivity is needed, jQuery still does the job really nicely.

discuss

order

KTibow|2 years ago

Now I might not know what I'm missing out on since I haven't worked in any projects w/ jQuery as I haven't been developing websites for a long time (and the type of sites I make probably also influences the stack), but there's probably something that does what you want as elegantly without jQuery.

We have stuff like querySelector and toggle in vanilla JS that makes it possible to change state simply, async stuff is much easier to understand than callbacks, and there are ways to split your code into components without using shadow or virtual DOM (see: raw web components, shadowdomless Lit, Svelte, etc). I've never found myself longing for something like jQuery.

skydhash|2 years ago

If you're creating a fully interactive webapp (google maps, docs, or apple music), go with one of the frontend frameworks because they will give you a much simpler way of managing states and binding it to the view layer. But the majority of websites are not apps or shouldn't be. You'd only have a couple of interactive elements if you strip the UX to its core. And that can be done easily with server rendered templates and a bit of jquery/vanilla js.