Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

What’s the difference to writing vanilla JS to do the same thing?


no differerence at all. jQuery functions like

  $('.foo').on('click', () => $.ajax(... $('.bar').html(result) ))
become unmanageable just as quickly.


So your complaint is not about HTMX, but about using any kind of JS without using a framework like React.


You 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.


That’s great for building JS apps, not so much for progressive enhancement of HTML.


I’d really like some explanation about what I’m misunderstanding, downvoting without explaining anything doesn’t help anyone.




Consider applying for YC's Winter 2027 batch! Applications are open till November 2.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: