|
|
|
|
|
by rupurt
2250 days ago
|
|
Happy LiveView user here :) Can confirm it can be used in many scenarios. One of my favorites is streaming realtime data to a chart. I serialize my data as JSON in the LiveView template and read it back in from a Hook. Saves me time by not having to create a separate API endpoint. e.g. <div
phx-hook="MyChart"
data-days="<%= Jason.encode!(days(@balances)) %>"
data-amounts="<%= Jason.encode!(amounts(@balances)) %>"
>
<div phx-update="ignore">
</div>
</div>
|
|