Skip to content

lubien/liveview_playground

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Your first LiveView!

The easiest way to have your LiveView running without boilerplate

Installation

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