The Case Against Single-Page Applications
CRUD interfaces often combine data retrieval, HTML rendering and forms. Hypermedia is one way to organize that interaction model.
HTMX's thesis is simple and almost offensively obvious: what if we just sent HTML over the wire?
HTMX 2.0: What Actually Changed
HTMX 2.0 (released stable in late 2025) isn't a revolution over 1.x, but the refinements matter. Here's what's actually different:
The hx-on Syntax Overhaul
Check event syntax against the version being used. The older example:
<button hx-post="/api/items"
hx-on::after-request="handleResponse(event)">
Save
</button>
Became:
<button hx-post="/api/items"
hx-on:htmx:after-request="handleResponse(event)">
Save
</button>
The double-colon was causing issues with certain HTML parsers and CSP policies. The new syntax is more explicit and, importantly, plays nicer with Content Security Policy headers that disallow inline event handlers, since HTMX registers them programmatically.
Native WebSocket Extension (Stable)
The WebSocket extension graduated from experimental in 2.0, and it's genuinely excellent:
<div hx-ext="ws" ws-connect="/ws/notifications">
<div id="notification-feed" hx-swap-oob="beforeend">
<!-- Server pushes HTML fragments here -->
</div>
</div>
On the server side (Go example):
func handleWS(w http.ResponseWriter, r *http.Request) {
conn, err := upgrader.Upgrade(w, r, nil)
if err != nil {
return
}
defer conn.Close()
for notification := range userNotifications(r.Context()) {
html := renderNotificationHTML(notification)
conn.WriteMessage(websocket.TextMessage, []byte(html))
}
}
No JSON serialization. No client-side template rendering. No state synchronization. The server sends a <div> with the notification content, and HTMX drops it into the DOM. That's it.
Server-Sent Events (The Underrated Gem)
For unidirectional real-time data, SSE is almost always the right choice over WebSockets. HTMX 2.0 makes it trivial:
<div hx-ext="sse" sse-connect="/events/dashboard-metrics">
<div sse-swap="cpu-update" hx-swap="innerHTML settle:300ms">
<span class="metric">Loading...</span>
</div>
<div sse-swap="memory-update" hx-swap="innerHTML">
<span class="metric">Loading...</span>
</div>
<div sse-swap="request-count" hx-swap="innerHTML">
<span class="metric">Loading...</span>
</div>
</div>
Each SSE event type can target a different HTML fragment. The server prepares the content and the client applies the swap.
hx-boost: Progressive Enhancement Done Right
hx-boost is probably the single feature that sells HTMX to skeptics. Add it to your body tag:
<body hx-boost="true">
And every <a> tag and <form> in your page is automatically "boosted", clicks and submissions are intercepted, the request is made via AJAX, and only the <body> content is swapped. The browser URL updates, history works, back/forward works. Your multi-page app feels like a SPA with zero code changes.
Progressive enhancement depends on preserving working links and form submissions when JavaScript is unavailable. Verify that behavior for each interaction.
Comparing implementations
Compare the same feature and behavior in each implementation. Publish source code, package versions, device and network settings, build configuration and repeated measurements before reporting a performance advantage.
The Pattern That Changed Everything: OOB Swaps
Out-of-band swaps are HTMX's answer to "but what about updating multiple parts of the page?" When the server responds to a request, it can include extra HTML fragments tagged with hx-swap-oob:
<!-- Primary response (swaps into the target) -->
<tr id="user-42">
<td>Updated Name</td>
<td>updated@email.com</td>
</tr>
<!-- Out-of-band: also update the notification count -->
<span id="notification-count" hx-swap-oob="true">3</span>
<!-- Out-of-band: also update the last-modified timestamp -->
<time id="last-modified" hx-swap-oob="true">Just now</time>
One HTTP response updates three different parts of the page. No client-side state management. No Redux. No Zustand. No signals. The server knows the full state, renders all the HTML fragments that changed, and sends them in a single response.
When HTMX Is the Wrong Choice
I'd be dishonest if I didn't cover the cases where I'd still reach for React:
Collaborative real-time editing, think Google Docs or Figma. The conflict resolution and operational transforms need client-side logic that doesn't map to hypermedia.
Offline-first applications, HTMX needs a server. If your app must work without network, you need a client-side data layer.
Complex drag-and-drop interfaces, Kanban boards, workflow builders. The interaction model is fundamentally client-side.
Dense data visualizations with interactivity, Zooming, panning, brushing on charts. Server-rendered SVGs work for display, but interactive exploration needs client JS.
For everything else, and I mean this seriously, HTMX is not just viable, it's often the better choice.
Incremental migration
Start with a bounded interaction and keep a rollback path. Convert a simple CRUD screen, validate forms and navigation, then evaluate whether the remaining interactions fit a server-rendered model. Remove dependencies only after verifying they are no longer used. This is an adoption outline, not a reported client migration.
The Preload Extension: Perceived Performance
One more pattern worth sharing. HTMX's preload extension makes navigation feel instant:
<body hx-boost="true" hx-ext="preload">
<nav>
<a href="/dashboard" preload="mousedown">Dashboard</a>
<a href="/users" preload="mousedown">Users</a>
<a href="/settings" preload="mousedown">Settings</a>
</nav>
</body>
preload="mousedown" fires the request on mousedown (which happens ~100-150ms before the click event). By the time the click registers and HTMX processes the boost, the response is usually already cached. Combined with server response times under 50ms, navigation feels literally instant.
Editorial method and scope
Reviewed on November 10, 2026. Unsupported claims of personal production experience and numerical results were removed. The remaining examples explain techniques; their presence is not a claim that they were executed in this review. This revision is not a complete validation of every API, version or code sample in the article.