Live data from Hacker News

Ask HN: Any Modern Alternative to JQuery?

news.ycombinator.com

1–10 of 26 posts

Ask HN: Any Modern Alternative to JQuery?

#1
I'm an experienced Django developer and I am trying build a modern looking website.

I was trying to complete a React course on Udemy but realised that React (Webpack, Redux, Next, Hooks, etc.) may be an overkill and lead to lot of wasted dev time for my usecase. I have used jQuery previously and the application eventually devolved into spaghetti.

Is there anything better than jQuery but not as complex as react and that integrates well with a backend like Django?

Re: Ask HN: Any Modern Alternative to JQuery?

#2
You don't need jQuery. Every problem jQuery solved has been standardized into native javascript so you can just use Javascript to build web apps.

For example instead of $(".button"), you can do document.querySelector(".button"), and so on.

That said, if you must use a framework and looking for something less complicated than react, look into Vue or Svelte.

Re: Ask HN: Any Modern Alternative to JQuery?

#3
A “modern looking” web site doesn’t really need any JavaScript framework or library. What are you looking for that vanilla JavaScript cannot provide?

There are, of course, alternatives to React. Angular, Svelte, and Vue are among the most popular. There are even light weight versions such as Alpine. But it’s hard to make any recommendations without understanding your requirements.

Re: Ask HN: Any Modern Alternative to JQuery?

#4

You don't need jQuery. Every problem jQuery solved has been standardized into native javascript so you can just use Javascript to build web apps. For example instead of $(".button"), you can do document.querySelector(".button"), and so on. That said, if you must use a framework and looking for something less complicated than react, look into Vue or Svelte.

> Every problem jQuery solved has been standardized into native javascript

Some problems, sure. Every problem? I think that's a stretch. Jquery still has it's applicability and can in some cases lead to simpler code.

Re: Ask HN: Any Modern Alternative to JQuery?

#7
Unless there is code which explicitly needs jQuery, most bindings/helpers are available here: http://youmightnotneedjquery.com/

Since you're building such a website, a common option for you may be to use a lightweight framework like Svelte/Sapper as your client. I've been using this for most projects with a Django backend.

Re: Ask HN: Any Modern Alternative to JQuery?

#8

You don't need jQuery. Every problem jQuery solved has been standardized into native javascript so you can just use Javascript to build web apps. For example instead of $(".button"), you can do document.querySelector(".button"), and so on. That said, if you must use a framework and looking for something less complicated than react, look into Vue or Svelte.

> Every problem jQuery solved has been standardized into native javascript Some problems, sure. Every problem? I think that's a stretch. Jquery still has it's applicability and can in some cases lead to simpler code.

Like what? The main purpose of jQuery was to have a unified API for dealing with the issue of every browser having their own quirky implementation of the web standard. All of those are gone today and we now have a pretty much standardized Javascript that you can write once and run in any browser.

Re: Ask HN: Any Modern Alternative to JQuery?

#9
I want to try this soon:

https://htmx.org/

htmx allows you to access AJAX, CSS Transitions, WebSockets and Server Sent Events directly in HTML, using attributes, so you can build modern user interfaces with the simplicity and power of hypertext

htmx is small (~9k min.gz'd), dependency-free, extendable & IE11 compatible

Re: Ask HN: Any Modern Alternative to JQuery?

#10
Imho you just need to get rid of Redux, it's unnecessary complexity for most React apps where hooks + props are already enough to do most of the work.

Also, TailwindCSS is complementary imo.

I think one pro React has is its performance advantage over jquery and handled edge cases. There are some others like Vue or Svelte which could be more performant on other cases but I have bias on React because of its ecosystem, e.g. if I want cute icons I know FontAwesome has its own dedicated react component. Cute charts? Airbnb has visx charting components.

Post reply on HN