|
|
|
|
|
by shawa_a_a
238 days ago
|
|
They're probably using some features of LiveView; I'm not too familiar with how HTMX works, but with LiveView you can define all of your logic and state handling on the _backend_, with page diffs pushed to the client over a websocket channel (all handled out of the box). It comes with some tradeoffs compared to fully client-side state, but it's a really comfortable paradigm to program in, especially if you're not from a frontend background, and really clicks with the wider Elixir/Erlang problem solving approach. https://hexdocs.pm/phoenix_live_view/js-interop.html#handlin... Hooks let you do things like have your DOM update live, but then layer on some JS in response. For example you could define a custom `<chart>` component, which is inserted into the DOM with `data-points=[...]`, and have a hook then 'hydrate' it with e.g. a D3 or VegaLite plot. Since Phoenix/LiveView is handling the state, your JS needs only be concerned about that last-mile JS integration; no need to pair it with another virtual DOM / state management system. https://hexdocs.pm/phoenix_live_view/js-interop.html#client-... |
|