Skip to content

Instantly share code, notes, and snippets.

@mhanberg
Created April 19, 2020 05:33
Show Gist options
  • Select an option

  • Save mhanberg/f93367bf1690ae3d239e37ce4ee5a9e9 to your computer and use it in GitHub Desktop.

Select an option

Save mhanberg/f93367bf1690ae3d239e37ce4ee5a9e9 to your computer and use it in GitHub Desktop.
defmodule PipsqueakWeb.DemoLive do
use Phoenix.LiveView
import Temple, only: [render: 1]
render do
div do
div do
"Current temperature #{@temperature}"
end
button phx_click: "increase" do
span do
"increase"
end
end
end
end
def mount(_, _, socket) do
{:ok, assign(socket, :temperature, 0)}
end
def handle_event("increase", _, socket) do
{:noreply, assign(socket, :temperature, socket.assigns.temperature + 1)}
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment