Conways Game of life using HATEOAS and HTMX
February 27, 2025
I’ve been playing around more with HTMX and one of the really cool features that I think we need to talk more about is the ability to trigger client side events from the server. This is accomplished by using the hx-trigger header and elements on the page can listen for events using hx-trigger: myEvent from body.
This means that it’s easy to inform the client that something has happened and then let the client take appropriate actions. For example, imagine that we put an item in the shopping cart. The server responds with the event SHOPPING_CART_UPDATED. A lot of elements on the page can now update based on this event; counter in the shopping cart, list of “other people also bought”, a banner with discounts etc.
Event driven client side architecture. Just imagine what this could do for micro frontend, where each component might...