5 ms·
no differerence at all. jQuery functions like $('.foo').on('click', () => $.ajax(... $('.bar').html(result) )) become unmanageable just as quickly.
by jhp123 3y ago
no differerence at all. jQuery functions like
$('.foo').on('click', () => $.ajax(... $('.bar').html(result) ))
become unmanageable just as quickly.
- Semaphor 3y agoSo your complaint is not about HTMX, but about using any kind of JS without using a framework like React.
- Semaphor 3y agoI’d really like some explanation about what I’m misunderstanding, downvoting without explaining anything doesn’t help anyone.
- jhp123 3y agoYou don't need a framework like React but you should try to implement modules that are explicit about their dependencies and use local state as much as possible. For example the upvote could be implemented like this: function renderUpvote(container, showNotification) { $("<button>").appendTo(container).on("click", () => $.ajax( ... result => showNotification( result )) } Now the notification action is passed in from a parent component. It's easy to trace where it comes from. You can also declare local variables in this function and have confidence that they will only be manipulated by callbacks within the module. This is how I wrote frontend code before React came out.
- Semaphor 3y agoThat’s great for building JS apps, not so much for progressive enhancement of HTML.