Hacker News new | ask | show | jobs
by yawaramin 97 days ago
But surely even in a SPA you have to eventually send a request and get a response? Like you're not going to suggest that eg in an online store webapp the user would click 'add to cart' and you wouldn't send a request to add the item to the cart and wait for and render the response?

Hypermedia libraries like htmx etc. are just doing these interactions, the ones that need a server request-response cycle. The difference is they get the response as already-rendered HTML, so they don't need to do anything further, just swap it in to the existing page. It's super simple and very efficient. And usually results in fewer AJAX calls which also are much more minimal and don't include any redundant data.