3 ms·
Why the heck would you use jQuery in 2023 though?
by EspressoGPT 3y ago
Why the heck would you use jQuery in 2023 though?
- nprateem 3y agoMy main use case will be basic UI interaction, mostly just posting or fetching data from a backend then updating the innerHTML on some element. Vanilla might be enough, but I'm keeping my options open. Also, no compilation step, so no need for npm, etc
- maxboone 3y agoIMO that's where alpine.js complements HTMX, you can use HTMX mainly for interfacing with a server and then use alpine.js for any special interaction that does not require a round-trip with the server.
- bardak 3y agoThat's my thought as well. Anything that needs new data from the server uses HTMX and if you need to manipulate something already on the page use Alpine, Jquery, vanillajs, or whatever other framework you prefer.
- rodorgas 3y agoJQuery would make sense when we didn’t have querySelector and fetch API. I can’t think of any reason to use it today on a new project, there are not advantages over vanilla.
- tambourine_man 3y agoThe native API is much more verbose and less composable. It was a real lost opportunity.
- antiatheist 3y agoconst $ = document.querySelector.bind(document) const $$ = document.querySelectorAll.bind(document)
- tambourine_man 3y agoOh, I wish it was that simple.
- synergy20 3y agojQuery's syntax is 10x better than vanilla javascript
- antiatheist 3y agoBullshit, the jQuery "Ajax" API is a hellish convoluted nightmare with zero consistency. https://api.jquery.com/category/ajax/ https://api.jquery.com/category/ajax/ Have you seriously looked at this and thought "yeah thats better than using a single native function (fetch)"? As for the rest of the API - what would you even use besides the css and selector functions? Which again, the native `classList` and a simple bind to the selectors are simpler and less verbose.
- mejutoco 3y agoJquery does not solve everything, but it does have a nice api $(this).closest(".cont") for example, is pretty nice in jquery.
- EspressoGPT 3y agoI'd strongly suggest using something like ArrowJS instead of jQuery for that.
- tambourine_man 3y agoBecause it’s much cleaner, readable code than anything created since.
- varispeed 3y agoIt's a boring and battle proven tool that just works and has no use by date, by the way.
- EspressoGPT 3y agoIt has. The issue jQuery was designed to solve doesn't exist anymore, hence there's no reason to rely on this heavy and convoluted library any longer. There really are better solutions.
- varispeed 3y agoWhat do you mean the issue doesn't exist?