Get the latest tech news
Augmenting the Client with Htmx
This post is part of a series comparing different ways to implement asynchronous requests on the client to augment the latter. So far, I described the process with Vue.js and Alpine.js. Both are similar from the developers' point of view: they involve JavaScript. In this post, I’ll focus on HTMX, whose approach is quite different. Laying out the work I’ll follow the same structure as in the previous posts of the series. Here’s the setup, server- and client-side. Server-s
At initial load time, we use Thymeleaf’s replace directive; we use HTMX for asynchronous client-side interactions. That’s the heart of HTMX: bind an HTTP call to a client-side event, and replace the configured DOM element with the server response. In a real-world scenario, you should check/uncheck the checkbox depending on the value returned to avoid keeping the server state and the UI in synch.
Or read this on Hacker News