logoalt Hacker News

Please just try HTMX

580 pointsby iNiclast Thursday at 2:18 PM459 commentsview on HN

Comments

on_the_trainlast Thursday at 5:38 PM

But how to actually manage non trivial state? URLs get big pretty fast

show 1 reply
boredumblast Thursday at 5:48 PM

please, just use html/css and some javascript where applicable.

insane_dreameryesterday at 5:47 AM

Love it! The reality is that I don't need an overly complicated SPA. I'm totally fine with AJAX requests like JQuery was still in style. The ability to do this with HTMX is awesome.

csomaryesterday at 5:15 AM

If you don't need React, you probably don't need a framework anyway. The reason I use React is to create components that can exist on their own (and can be constructed/visualized on a StoryBook) and these components will then play nice with other React components. And then use JSX to make reasoning about the code simple. That's not what htmx is.

> htmx is a library that allows you to access modern browser features directly from HTML, rather than using javascript.

From React website:

> React lets you build user interfaces out of individual pieces called components. Create your own React components like Thumbnail, LikeButton, and Video. Then combine them into entire screens, pages, and apps.

Apples and Oranges.

adamzwassermanlast Thursday at 5:00 PM

Even if you do have complex client-side state: dataos.software

srfroglast Thursday at 6:01 PM

I'm the CEO of HTML. I approve of unpoly. A+++++

ndrlast Thursday at 3:21 PM

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]

show 2 replies
mvdtnzlast Thursday at 6:02 PM

I haven't used HTMX but the author doesn't make a very convincing case. On the one hand they say,

> "But what about complex client-side state management?"

> You probably don't have complex client-side state. You have forms. You have lists. You have things that show up when you click other things. HTMX handles all of that.

On the other hand,

> I'm not a zealot. HTMX isn't for everything.

> Genuinely complex UI state (not "my form has validation" complex—actually complex)

But my interpretation is that any UI which displays the same data in just two places (like a "new notification" indicator as well as bolding new messages in an inbox, or a list of articles which can change dynamically as well as a count of the number of articles) is "complex" enough that you'll need client side state.

show 1 reply
tantalorlast Thursday at 3:31 PM

The author has never heard of jQuery

bjordlast Thursday at 4:25 PM

please just try TLS

littlecranky67last Thursday at 5:12 PM

Can we see a styled date-time picker in htmx?

show 1 reply
dana321last Thursday at 5:07 PM

_another fucking framework_

robinhoodlast Thursday at 6:37 PM

Yet another thread of React vs the rest of the world. Each has its use case, and most of the time, React/Vue are largely overkill. Personally, I would never, ever, ever start another React project again. The nightmare of the horrible JS ecosystem, build steps and tooling is behind me. All my projects now use either HTMX or Alpine Ajax - and for web apps that are actually pretty large. It works perfectly fine. Add Turbo to the mix and you almost have the feeling of using a real SPA, without the headache and large bundled JS files. Feels refreshingly simple. Still have to figure out the no-build step so I can completely drop Bun/Yarn/Npm, and life will be a wonderful thing.

ericarogulskilast Thursday at 6:25 PM

[dead]

michaelyinyesterday at 1:54 AM

[dead]

wetpawslast Thursday at 5:43 PM

[dead]

hmanslast Thursday at 8:44 PM

[dead]

iamsaitamlast Thursday at 3:18 PM

..and be unemployed.

The article doesn't define any target audience in specific, so there you go.

show 2 replies
TeodorDyakovlast Thursday at 3:04 PM

what is the use case. I did not read the page. Can you tell me where stars live?