| ▲ | JSR_FDED 3 days ago | |||||||||||||||||||||||||||||||||||||
I think the ideas behind HTMX are cool, and Carson’s advocacy around Hypermedia is great. I came from SPA-land and was tired of the fundamental architectural issue of having to keep the front-end and back-end state in sync. I’ve compared Datastar and HTMX and decided on Datastar. There’s overlap between the two libraries in that they both support the request/response model, but with Datastar my learning investment takes me further and opens up new possibilities. In one project I was able to remove a bunch of polling code and simply push a signal from the server to the browser when an external event occurred. The reduction in complexity was crazy. On an internal tool I noticed I didn’t need Alpine.js anymore, and while anytime I can remove a dependency is a good time, the conceptual simplicity is what really makes me happy. Now I’m doing a small app where I decided to make a streaming connection between browser and server and simply regenerate and send the entire view over that connection anytime something changes. Intuitively this felt wasteful but it turned out that with compression this works beautifully. There’s just less code in my app, and the code that’s there is less “fiddly” not having to deal with partial updates of the page. If you’re coming from the world of SPAs, definitely check out both. | ||||||||||||||||||||||||||||||||||||||
| ▲ | nprateem 3 days ago | parent [-] | |||||||||||||||||||||||||||||||||||||
Datastar looks interesting, but their guide on how to redirect a user is a joke. async def redirect_from_backend():
LOL, they really think it's a good use of server resources to sleep so the client doesn't have to.[1] https://data-star.dev/how_tos/redirect_the_page_from_the_bac... | ||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||