5 ms·
I always feel like these HTMX examples just shift complexity to other parts of the stack. JSX is a really elegant way to avoid templating, but we're back to tem
by causal 2y ago
I always feel like these HTMX examples just shift complexity to other parts of the stack. JSX is a really elegant way to avoid templating, but we're back to templating with HTMX, and you can easily reintroduce a complex set of libraries just trying to handle that with any scale.
Routing, state management, auth, components, theming, API access, and more are all still problems that people add libraries for and those problems don't go away just because you've abandoned the ecosystem with the most libraries.
- kelvinjps10 2y agoBut for those problems there are decades old frameworks like django and Ruby on rails, laravel etc that solve these issues in a simpler way
- raincole 2y agoI don't even know what problem this author has with React and how switching to HTMX is going to help them (after reading the article twice). > Some of the worst offenders in this respect were wouter (a React router package) and TanStackQuery (which I was using to fetch, cache and manage state from the backend). Ok so don't use wouter and TanStackQuery...?
- recursivedoubts 2y agoYou do collapse an implementation layer by using HATEOAS[1], which can save overall complexity in the system: https://htmx.org/essays/a-real-world-react-to-htmx-port/ https://htmx.org/essays/a-real-world-react-to-htmx-port/ It's mainly an interactivity/simplicity tradeoff, sometimes the right trade other times not. A lot of people are using JSX on the server side w/htmx because it's a good and familiar templating option on the server side. [1] - https://htmx.org/essays/hateoas/ https://htmx.org/essays/hateoas/
- causal 2y agoWait did I just get a response from Carson himself? :) Though my comment belies it I'm a big fan of the work - I started following Intercooler a decade ago and I'm happy to see how far things have come. I'm curious about HTMX + JSX, any recommended examples there?
- recursivedoubts 2y ago:) hono has a demo using it: https://hono.dev/examples/htmx https://hono.dev/examples/htmx
- dsego 2y ago> Routing, state management, auth, components, theming, API access, and more are all still problems that people add libraries for A lot of this goes away if you choose a server-side framework that handles its own routing, auth, api, templates etc. And the state management also goes away if you don't need complex stateful widgets on the frontend.
- zarzavat 2y ago> And the state management also goes away if you don't need complex stateful widgets on the frontend. Browsers come with a very limited selection of widgets, almost everything I make requires at least one custom widget, usually significantly more than one. How can you possibly know when you start a project that you won't need to make any complex stateful widgets?
- wild_egg 2y agoIf they really are that complex, then use react for them. One of the biggest issues I have always had with react proponents is the "well if I need react for X then I might as well build the whole thing in react." Islands Architecture is really not complicated. The bulk of your app can be very simple hypermedia exchanges and components and when you need a really fancy widget, load it and mount it where it needs to be.
- JamesBarney 2y agoYou can build a complex stateful widget in a MPA.
- WorldMaker 2y agoI feel like a lot of the arguments for HTMX are simply delight in having "permission" to build MPAs again. Backend stacks are historically good at routing/state management/auth and more, everything old is new again. But also, yes, not everything needs to be a SPA and maybe we've just reached the point to start asking again "why is this a SPA?" > JSX is a really elegant way to avoid templating JSX is still a templating language. It's just an "inverted one" where the templates are embedded in scripts rather than the other way around. That said, I do think it is a very elegant templating system, especially because it can be type checked with Typescript. TSX is a massive improvement on most template compilers in part because it has such a massive types ecosystem today. (My own efforts in "post-React"/"post-Angular" have been TSX-based. I've got a Knockout-inspired view engine with a single runtime dependency on RxJS. It has a developer experience similar to React, but isn't a virtual DOM, and has some some interesting tricks up its sleeve. I'm really happy with TSX as the template language for it.)
- causal 2y agoAgreed. I also think React did the world a favor by making functional programming a little more mainstream, which is part of what makes JSX/TSX feel so magical when it works.
- jakubmazanec 2y ago> JSX is still a templating language No, it isn't a templating language, it's still just JavaScript - calls to createElement or _jsx or other function with some syntactic sugar to make it look like HTML.
- svachalek 2y ago> with some syntactic sugar isn't that what a templating language is?
- jakubmazanec 2y agoNo. Do you seriously don't understand the difference between JSX, a simple syntax extension that compiles to JavaScript function calls, and a templating language, for example Vue's templating syntax [1] or EJS [2] ? [1] https://vuejs.org/guide/essentials/template-syntax https://vuejs.org/guide/essentials/template-syntax [2] https://ejs.co/ https://ejs.co/
- mekoka 2y agoFor the past 4 years, most objections to HTMX have come in the form of your comment. A look from afar, trying to speculate on what development must be like. After 4 years of mature devs taking it for a spin and reporting back with a thumb up, maybe it's best to try to actually use it in a project of your own and see how close your predictions match reality. Perhaps you even have experience with it of course. In which case, it'd be interesting/useful to voice your objections more specifically.
- yawaramin 2y ago> JSX is a really elegant way to avoid templating, but we're back to templating with HTMX Not necessarily. There are libraries in all mainstream languages that let you embed HTML generation directly in your backend server itself, without using a templating engine. Some examples: Python: https://htpy.dev/ https://htpy.dev/ Scala: https://com-lihaoyi.github.io/scalatags/ https://com-lihaoyi.github.io/scalatags/ OCaml: https://yawaramin.github.io/dream-html/ https://yawaramin.github.io/dream-html/ (that's mine) > Routing, state management, auth, components, theming, API access, and more are all still problems that people add libraries for and those problems don't go away Actually they kinda do go away. Have you ever tried Ruby on Rails? It does all this out of the box.