Created
April 19, 2020 05:33
-
-
Save mhanberg/f93367bf1690ae3d239e37ce4ee5a9e9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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