4 ms·
I've found Htmx to be smug and misleading. "Look how simple it is! No JavaScript! Ignore the fact that you need a complex backend in a separate language and env
by robertoandred 2y ago
I've found Htmx to be smug and misleading. "Look how simple it is! No JavaScript! Ignore the fact that you need a complex backend in a separate language and environment to generate your html."
- mixmastamyk 2y agoIf you eliminate most of the frontend, of course you're going to need a backend. Otherwise you have no app. Intelligent post there.
- rednafi 2y agoSeparate language is fine for those of us willing to write anything but JS. As long as it means writing less JS, a separate backend isn’t that big of a deal.
- robertoandred 2y agoNot everyone is so scared of JS that we need separate silos for rendering in the browser and rendering on the server.
- andybak 2y agoConsider it might not be fear but a strong dislike based on solid philosophical and/or aesthetic reasons. Some of the people you're dismissing have probably been using JavaScript for a lot longer than you have.
- robertoandred 2y agoThere's nothing philosophically or aesthetically good about <button hx-get="/confirmed" hx-trigger='confirmed' onClick="Swal.fire({title: 'Confirm', text:'Do you want to continue?'}).then((result)=>{ if(result.isConfirmed){ htmx.trigger(this, 'confirmed'); } })"> Click Me </button> or about <div hx-get="/clicked" hx-trigger="click[ctrlKey]"> Control Click Me </div> or <form id="example-form" hx-post="/test"> <input name="example" onkeyup="this.setCustomValidity('') // reset the validation on keyup" hx-on:htmx:validation:validate="if(this.value != 'foo') { this.setCustomValidity('Please enter the value foo') // set the validation error htmx.find('#example-form').reportValidity() // report the issue }"> </form> Htmx's own examples push you to code that is unorganized and inaccessible.
- bdangubic 2y agoyou can take anything in this type of context and it will look unorganized and inaccessible. react, angular, svelte, whatever-framework-du-jour … and much much worse than these examples
- robertoandred 2y agoNone of those will eval element attribute strings as JS.
- bdangubic 2y agoevery one of them has warts and insane shit
- WD-42 2y agoIronically I can read through this code and know exactly what it does with no other context. I don’t even know what swal is but I can still tell what it does.
- sensanaty 2y agoI mean sure, but compare that to <button @click="doThing"> In Vue. Or just plain old JS onclick in Svelte. By comparison, HTMX is illegible
- WD-42 2y agoWhat does "doThing" do? I can't tell by reading. The above examples, while maybe slightly verbose, are completely self contained!
- sensanaty 2y agoSorry was typing that on my phone so got lazy, `doThing` would be a method/function of some sort. You can also write it inline if you so wish, like `@click="console.log('hello')"`
- rednafi 2y agoIt’s not being scared of JS. It’s a weakly typed, poorly designed, gotcha-ridden, hodgepodge of a language. What’s there to be scared of? It’s just people would rather write a low level, well-designed language than maintain JS codebases.
- deleted 2y ago[deleted]
- WD-42 2y agoWhy does it have to be a separate language? You can serve templates with javascript, thus it works just fine with HTMX. I think you have some fundamental misunderstanding.
- robertoandred 2y agoIf you're using JavaScript to render templates, why have an awkward disconnect between what renders on the server and what renders in the browser?
- yawaramin 2y agoNowhere does htmx say 'No JavaScript'. We say 'targeted, high-leverage use of JavaScript'. And neither do we say 'ignore' that you need a 'complex' backend (backends do complex work, they will be incidentally complex to a certain extent anyway). We say HOWL–Htmx On Whatever you Like. It works with any backend and language you prefer and that's strength. Believe it or not, people use languages other than JavaScript.
- robertoandred 2y agoExcept you bill yourself as a replacement for React, Next, etc. No more components! No more state! No more crazy logic or builds or code or maintenance! Just use htmx, everything becomes so simple! None of that goes away, of course, it just moves to a different repo.
- yawaramin 2y agoWe don't bill htmx as a replacement for React or Next, only for the use cases that make sense for its capabilities, which often happen to be things people are using React and Next for because that's all they know. Actually, duplication of state, routing logic, auth logic, etc. really do get eliminated. Because we're maintaining all that on the server-side only and not having to reproduce it on the client side. It's a huge win.
- robertoandred 2y agoReally? You’re keeping track of which slide Jane Doe has switched Carousel X to on the server?
- neeleshs 2y agoDo you do this in raw react, or use some third party carousel library? If so, maybe something like that can be used with HTMX as well? But your larger point stands, HTMX is probably not a great fit for highly interactive webapps, even though you can push it pretty far
- 2y ago
- jiriknesl 2y ago> No JavaScript! Ignore the fact that you need a complex backend in a separate language Backend in a language that isn't JavaScript is a feature. Also, a backend where you just serve a template instead of full layout (server-side rendered app) or JSON (client-side rendered app) is not more complex in most of scenarios.