How to Render Dynamic Variables in a Phoenix LiveView
From ElixirBlocks
Installing Phoenix
This article assumes that you have installed the Phoenix web framework and all its dependencies correctly without errors. If you have not installed the Phoenix web framework please view the documentation here
To create a working Phoenix LiveView application please read this article.
Rendering Dynamic Variables
defmodule AppWeb.PageLive do
use AppWeb, :live_view
def mount(_params, _session, socket) do
{:ok, assign(socket, greeting: "Hello World")}
end
def render(assigns) do
~H"""
<%= assigns.greeting %>
"""
end
end