▲ | bargainbin 2 days ago | ||||||||||||||||||||||
I’ve attempted to use HTMX a few times (as a React-hater, its hype lures me in) and every time I’ve come away feeling like I’ve wasted my time implementing a subpar solution. From reading this, I’ve decided I will never attempt to use it again. All I could think was, just use Go’s HTML templating. What is HTMX adding, really? | |||||||||||||||||||||||
▲ | bananapub 2 days ago | parent | next [-] | ||||||||||||||||||||||
(out of interest: did you ever write web apps before ~2010 or so? the answer to your question seems so obvious to me I'm not even sure where the confusion could come from, unless you've only ever written web apps that are "JS frontend, JS backend, magic communication between them, it's often not clear where some bit of code is running"). HTMX here is making it so the page works without doing a full HTTP form submission + page load for each stage of the "wizard". instead, you write some HTMX stuff in the page that submits the form asynchronously, then the server sends back the HTML to replace part of the page to move to you to the next step in the "wizard", and then HTMX replaces the relevant DOM nodes to make that so. Go's templating is completely unrelated to any of this happening on the front end - it's just generating some HTML, both the "whole page loaded by the browser normally" and the "here's the new widget state code", and so obviously: > just use Go’s HTML templating. is incorrect. | |||||||||||||||||||||||
| |||||||||||||||||||||||
▲ | hirvi74 2 days ago | parent | prev [-] | ||||||||||||||||||||||
I have had similar experiences too. To me, HTMX felt like a wrapper around vanilla JS's .fetch() or jQuery's AJAX calls except one just litters the HTML with specific custom HTML attributes. .fetch() has no issues returning server-side rendered HTML and has a lot more options and freedom than what HTMX provides. I do not think HTMX is a bad library by any means. I just can't see what it buys over vanilla JS. |