top | item 44455803

(no title)

joshmanders | 8 months ago

> To me that feels like less magic to remember than

Ehhh, only seems that way because you're so entrenched in React with minimal htmx experience.

I've used both pretty extensively and they both feel similar in the magic aspect, except htmx is cleaner.

discuss

order

pier25|8 months ago

> except htmx is cleaner

I've had the opposite experience.

Htmx does work for simpler use cases like submitting a login form. Beyond that it gets messy very quickly as you start introducing more backend endpoints for every little interaction. In some stacks you have template fragments[1] which alleviate this problem somewhat but still, htmx doesn't scale for more sophisticated interactivity.

And most projects will still need client-side interactivity. So now your features are a mix of htmx stuff, something client-side (Alpine, Vue, whatever), and probably some HTTP endpoints to interact with the client-side stuff.

You also still need to take care of CSS which htmx completely ignores because it's really just a low level HTML exchange protocol if you will. With Vue, Astro, or Svelte you can encapsulate markup, behavior, and styles in a single file.

And on top of all that, the DX is quite frankly terrible compared to doing frontend with something like Vite with hot module reloading. Most backend servers need to restart and maybe even recompile the whole thing. PHP is the only exception I know of since every request "runs the whole application".

[1] https://htmx.org/essays/template-fragments/

alexvitkov|8 months ago

The react snippet is one uppercase letter away from being vanilla js, it's definitely less magic.

yawaramin|8 months ago

I feel that as software engineers, instead of talking about things like 'feels like magic', we are capable of reading the docs and understanding what something actually does, especially when it's pretty simple: https://htmx.org/attributes/hx-get/

recursive|8 months ago

And if you made that change, despite being vanilla js, it still wouldn't work.