The easiest way to have your LiveView running without boilerplate
Create a file named main.exs
:
Mix.install([
{:liveview_playground, "~> 0.1.6"}
])
defmodule PageLive do
use LiveviewPlaygroundWeb, :live_view
def mount(_params, _session, socket) do
{:ok, assign(socket, :name, "World")}
end
def render(assigns) do
~H"""
Hello <%= @name %>
"""
end
end
LiveviewPlayground.start()
Then run elixir main.exs
. Congratulations! You have LiveView running at http://localhost:4000