How to Render Dynamic Variables in a Phoenix LiveView

From ElixirBlocks
Revision as of 06:17, 26 March 2023 by Admin (talk | contribs)
Jump to: navigation, search

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