Re:Htmx is part of the GitHub Accelerator
by EspressoGPT on Wednesday August 16, 2023 @07:21AM
(#37145394)
Why the heck would you use jQuery in 2023 though?
[ Parent
| on HN ]
Re:Htmx is part of the GitHub Accelerator
by tambourine_man on Wednesday August 16, 2023 @07:40AM
(#37145548)
Because it’s much cleaner, readable code than anything created since.
Re:Htmx is part of the GitHub Accelerator
by nprateem on Wednesday August 16, 2023 @07:24AM
(#37145413)
My 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.
Re:Htmx is part of the GitHub Accelerator
by rodorgas on Wednesday August 16, 2023 @07:32AM
(#37145486)
JQuery 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.
Re:Htmx is part of the GitHub Accelerator
by tambourine_man on Wednesday August 16, 2023 @07:41AM
(#37145562)
The native API is much more verbose and less composable. It was a real lost opportunity.
Re:Htmx is part of the GitHub Accelerator
by antiatheist on Wednesday August 16, 2023 @08:01AM
(#37145727)
const $ = document.querySelector.bind(document)
const $$ = document.querySelectorAll.bind(document)
Re:Htmx is part of the GitHub Accelerator
by tambourine_man on Wednesday August 16, 2023 @09:01AM
(#37146412)
Oh, I wish it was that simple.
Re:Htmx is part of the GitHub Accelerator
by synergy20 on Wednesday August 16, 2023 @07:51AM
(#37145651)
jQuery's syntax is 10x better than vanilla javascript
Re:Htmx is part of the GitHub Accelerator
by antiatheist on Wednesday August 16, 2023 @08:07AM
(#37145777)
Bullshit, the jQuery "Ajax" API is a hellish convoluted nightmare with zero consistency.
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.
Re:Htmx is part of the GitHub Accelerator
by mejutoco on Wednesday August 16, 2023 @10:05AM
(#37147210)
Jquery does not solve everything, but it does have a nice api
$(this).closest(".cont")
for example, is pretty nice in jquery.
Re:Htmx is part of the GitHub Accelerator
by maxboone on Wednesday August 16, 2023 @07:27AM
(#37145444)
IMO 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.
Re:Htmx is part of the GitHub Accelerator
by bardak on Wednesday August 16, 2023 @11:22AM
(#37148495)
That'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.
Re:Htmx is part of the GitHub Accelerator
by EspressoGPT on Wednesday August 16, 2023 @01:24PM
(#37150418)
I'd strongly suggest using something like ArrowJS instead of jQuery for that.
Re:Htmx is part of the GitHub Accelerator
by varispeed on Wednesday August 16, 2023 @07:45AM
(#37145592)
It's a boring and battle proven tool that just works and has no use by date, by the way.
Re:Htmx is part of the GitHub Accelerator
by EspressoGPT on Wednesday August 16, 2023 @01:28PM
(#37150474)
It 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.