Development··3 min read

HTMX: Is It Hype or the Real Deal?

Interactive web without React? I built a side project with HTMX and here's my honest take.

Building interactive web without a JavaScript framework?

When I first saw HTMX, my reaction was "does this actually work?" You send AJAX requests, update the DOM, and swap in server-rendered HTML -- all through HTML attributes. No React. No Vue.

I was skeptical but gave it a shot. Built a simple todo app as a side project. HTMX + Express + EJS.

First impression: insanely simple

Three attributes on a button -- hx-post="/todos" hx-target="#todo-list" hx-swap="beforeend" -- and clicking it sends a POST request to the server, takes the HTML response, and appends it to #todo-list. That's it.

In React, doing this requires state management, an event handler, a fetch call, response handling, re-rendering... 30 lines of code minimum. HTMX does the same thing with 3 HTML attributes.

No build step either. No webpack, no bundling. Load one HTMX script from a CDN and start coding. Fire up the dev server and go.

Then reality set in

Simple CRUD was genuinely fast to build. But as soon as things got slightly complex, the limitations showed.

Got stuck on a screen with 3 search filters applied simultaneously. Category, date range, and keyword -- changing one needed to preserve the other filter states while refreshing results. In React, you just manage this with state. In HTMX, everything has to go through URL parameters, and the code got messy fast.

(That's when I thought "oh, so this is why React exists.")

A word on server load

HTMX's model is server-rendered HTML on every request. React does an initial load and then renders on the client, keeping server load low. HTMX hits the server for HTML generation on every interaction.

Not a problem at side project scale. But for services with lots of concurrent users, server costs could climb. Same tradeoff as SSR.

Where HTMX shines

Admin pages, internal tools, MVP prototypes. No complex state management needed, mostly CRUD, and you need to ship fast. In the time it takes to set up React, you could have the feature done in HTMX.

It's also great for adding interactivity to existing server-rendered apps (Django, Rails, Spring). Don't split out a separate frontend -- just layer HTMX on top of the existing architecture.

The verdict

HTMX isn't hype -- it's a genuinely practical tool. But it doesn't replace React. It's an alternative for situations where React is overkill. Trying to build a complex SPA with HTMX is like bringing a shovel to do an excavator's job.

Glad I tried it. Next time I need a quick internal tool, I'll reach for HTMX. But I'm not building the main product with it. Probably.

Related Posts