Live data from Hacker News

Please just try HTMX

pleasejusttryhtmx.com

21–30 of 530 posts

Re: Please just try HTMX

#21
If you never seen HTMX it is a small js library that lets you swap some part of your dom with the responses from your webserver.

This means that in theory you (as a dev) don't need (to write any) js, nor do your users need to download a full page (for any interaction) like it's 1999. Your webserver replies with fully server-renderd HTML but just for the dom node (say a div) that you want to replace.

It's fun for very simple things, even great for extremely simple interactions modes. For interactive products, anything beyond simple CRUDs, it's madness.

Whenever you want to sprinkle a tiny bit of interactivity you'll have to choose between the path of least resistance (a small hack on HTMX) or a proper way. State management gets out of control real fast, it's the opposite of UI=f(state).

I've seen it go bad, then worse with alpine-js, and then completely ripped in favor of something where people can let the browser do browser things.

[edit for clarity]

Re: Please just try HTMX

#22
post #16

The thing is React is usually fine, and even if you don't have to build _this_ thing in React due to simplicity, why bother learning two paradigms when you can just use the heavier one for everything and most likely never encounter any real practical showstopping issue?

> why bother learning two paradigms

Objection. Your React is ultimately turning into HTML so you DO have to learn HTML + CSS. You just have an abstraction over it.

Re: Please just try HTMX

#23
post #7

Sorry, but it's a no from me. htmx is a great idea, but it's not necessary anymore. We're very close to invokers being baseline (and even that is just an extension of the "composedPath includes -> invoke" pattern), and that will take care of plenty of what htmx was designed to do. Between features like that, and web components, I'm very happy to stick with "plain HTML" (no frameworks; my web components do not draw fr…

> We're very close to invokers being baseline

Well why not have the benefits of invokers, but today - with HTMX?

HTMX could eventually switch its implementation to use invokers under the hood in the future, and you'd have the convenience of using declarative behaviors on your buttons, today.

> autocomplete can actually be fulfilled with a datalist element

I wish that the spec would cover more use cases, but last time I tried to use it, I couldn't, because it has really bad UX, and is inconsistent across browsers.

Also, like you mentioned, it only works for small data sets that you can deliver with the initial HTML, not large amounts of data which reside on the server.

You could argue that these are use cases where you wouldn't require an auto-complete in the first place, because the data set is too small.

Re: Please just try HTMX

#24
post #21

If you never seen HTMX it is a small js library that lets you swap some part of your dom with the responses from your webserver. This means that in theory you (as a dev) don't need (to write any) js, nor do your users need to download a full page (for any interaction) like it's 1999. Your webserver replies with fully server-renderd HTML but just for the dom node (say a div) that you want to replace. It's fun for very…

> it is a small js library ... This means that in theory you don't need js

I assume I'm not the only person left a little puzzled.

Do you mean "don't need JS" as in like, a full-fledged JS framework?

Re: Please just try HTMX

#25
post #11

> After the user downloads 2MB of JavaScript, waits for it to parse, waits for it to execute, waits for it to hydrate, waits for it to fetch data, waits for it to render... yes, then subsequent navigations feel snappy. Congratulations. In my experience, a lot of SPAs transfer more data than the front-end actually needs. One team I worked on was sending 4MB over the wire to render 14kb of actual HTML. (No, there wasn'…

even for "downloads 2MB of JavaScript", it is often simply because the site is badly written (e.g. not careful about managing dependency), not necessarily because "JAVASCRIPT BAD".

Just look at the source code of amazon.com. It's a mess. But I bet it is more of an organizational problem than a tech stack problem, for a website worked on by literally hundreds of teams (if not more) where everyone crams their little feature in the website home page

Re: Please just try HTMX

#26
For those who build in Ruby on Rails, does htmx have an advantage over Turbo/Stimulus? For me, the sense that it doesn't is why I've been avoiding it. Prefer to stick with vanilla stack unless there's a very compelling reason not to.

Re: Please just try HTMX

#27
I would even say that even "just html" is enough for most website/app. We've been using "just html" at my company ( rosaly.com) for 5 years, we've raised 10 million, have hundreds of customer, and nobody ever complained. And the Android/Ios applications are 234 lines of React-Native which is just embedding a webview , a bit of error screen when there's no internet connection , and intercom library for notification.

Re: Please just try HTMX

#28
The big problem I have with HTMX is the same one I have with React server components and similar concepts; I really like being able to just serve static files. Plus the clear separation of server and client really makes reasoning about a lot of different problem cases a lot easier, that's not something to dismiss lightly. (It's a bit of a 'ship your org chart' case, though)

Re: Please just try HTMX

#29
Hey, I created htmx and while I appreciate the publicity, I’m not a huge fan of these types of hyperbolic articles. There are lots of different ways to build web apps with their own strengths and weaknesses. I try to assess htmx’s strengths and weaknesses here:

https://htmx.org/essays/when-to-use-hypermedia/

Also, please try unpoly:

https://unpoly.com/

It’s another excellent hypermedia oriented library

Edit: the article is actually not nearly as unreasonable as I thought based on the just-f*king-use template. Still prefer a chill vibe for htmx though.

Re: Please just try HTMX

#30
post #21

If you never seen HTMX it is a small js library that lets you swap some part of your dom with the responses from your webserver. This means that in theory you (as a dev) don't need (to write any) js, nor do your users need to download a full page (for any interaction) like it's 1999. Your webserver replies with fully server-renderd HTML but just for the dom node (say a div) that you want to replace. It's fun for very…

> If you never seen HTMX it is a small js library that lets you swap some part of your dom with the responses from your webserver.

> This means that in theory you don't need js, nor do your users need to download a full page like it's 1999. Your webserver replies with fully server-renderd HTML but just for the dom node (say a div) that you want to replace.

You got this backwards. With HTMX you need js. But just to swap a div, you can use link target + iframe, like it's 1999.

Post reply on HN