Live data from Hacker News

htmx

htmx.org

241–250 of 291 posts

Re: htmx

#241
post #158

Earlier quoted context omitted.

You're outdated. Everyone is using Parcel now.

Funny, how even the sibling comment states something different. Maybe there are a lot of bundler bubbles in the JS world?

sorry, I said that 9 hours ago... now we're using Bun actually :D

Re: htmx

#243
post #149

I continue to be impressed at the effort people will put into avoiding writing any JavaScript. Is it really easier to learn yet another DSL embedded in attribute tags rather than taking a day to setup your JS dev environment and then writing idiomatic code for running inside a web browser? Surely your htmx project will eventually cross a complexity threshold where you've added enough scaffolding that you may as well…

Many people may disable js when browsing. So there's that.

HTMX requires JavaScript to work. If your goal is to render a usable page on the server and return it to the client, you can do that with plenty of full stack JS frameworks like Next.js, and as a bonus, it uses the same code to render it as it does on the frontend.

Re: htmx

#244

I'd still pick Unpoly over it. Seems far more high level, feature rich and easier to use although less popular. And if I wanted a popular approach I'd pick Hotwire which can be used with any backend framework anyways. https://unpoly.com/ https://hotwired.dev/

I am also interested in why you like Unpoly more. Genuinely curious because I use and like HTMX and don’t really understand what you get with Unpoly that you don’t with HTMX.

I could ask the same question I guess, what do you get from HTMX that I can't get from Unpoly?.

I think you can achieve the same thing with both, but Unpoly is higher level, that means I have to write less attributes/code to achieve the same stuff I guess.

"Compilers" are also a nice way to attach custom code. All the helpers for form validations, the extremely easy way it provides to do modals, and layers in general. The navigation feedback (a'la turbolinks) when navigating across pages, the caching, the error handling. The up-keep for keeping a video player or anything else across pages transitions, and absolutely everything of this can be accessed from a JavaScript API in case you need to perform any of this from your own code and most of these APIs also trigger events.

Probably you can do all of this with HTMX too, but it is more work.

Re: htmx

#245

I'd still pick Unpoly over it. Seems far more high level, feature rich and easier to use although less popular. And if I wanted a popular approach I'd pick Hotwire which can be used with any backend framework anyways. https://unpoly.com/ https://hotwired.dev/

Can you expand a bit on why you prefer unpoly over htmx ? I like htmx but I'm genuinely interested in alternatives around the same concept.

Just answered this on a sibling comment.

Re: htmx

#246
post #116

Earlier quoted context omitted.

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) {
    $("").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.

Re: htmx

#247
post #230
post #74

Earlier quoted context omitted.

let's say that you have an upvote button Upvote Well where is this notification-bar? It could be anywhere on the page. Maybe it was introduced by another htmx action from another endpoint. Answering this simple question could take a lot of work. There is no way to work it out systematically short of auditing every interaction on the page.

Isn't this comparable to any other situation where you reference something outside a project, even in C with libraries? (I've never used HTMX or even looked beyond this page for it, so maybe what I'm about to say is logically wrong.) If I said that for an HTMX project you must define all components you use within the project, wouldn't this hx-target example be very easy to identify quickly in the project? You simply…

if you decided to write C by building a lot of tiny global functions with no local state that called other globals functions, then it would greatly resemble programming with GOTO.

Re: htmx

#248
post #215
post #74

Earlier quoted context omitted.

let's say that you have an upvote button Upvote Well where is this notification-bar? It could be anywhere on the page. Maybe it was introduced by another htmx action from another endpoint. Answering this simple question could take a lot of work. There is no way to work it out systematically short of auditing every interaction on the page.

That's because this example is an anti-pattern, the swap should be local [1], the button changes itself (to an orange arrow, to disable itself, etc) and the notification tag (#notification-bar) should be responsible of its own behavior. An idea could be that the notification bar is polling a notification endpoint every Xsec or on a specific event [2], or if you want to be fancy with WebSockets [3] [1] They actually t…

This doesn't help. Now the implementation depends on another component correctly reading some global state, an undeclared dependency. If I'm reading the upvote button I have no idea that it uses a notification-bar. If I'm reading the notification-bar I have no idea what it's for or who uses it.

Re: htmx

#249
post #246

Earlier quoted context omitted.

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) { $(" ").appendTo(container).on("click", () => $.ajax( ... result => showNotification( result )) } Now the notification action is passed in from a paren…

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

Re: htmx

#250
The crucial flaw with htmx is that it’s an enhancement of html itself; if a fancy and interesting new UI pattern is invented somewhere, the htmx devs or contributors will have to add support for it into htmx itself!

And imagine if htmx became absorbed into the real html standard. It would take much longer for the standards body (and then browser makers) to respond and implement.

So the crucial flaw is that it will always be reacting instead of innovating. And more generally, this is likely why the “thick client” approach is more popular on the web these days. Nobody wanted to wait around for standards bodies and browser makers.

Post reply on HN