LiveView
LiveView keeps state on the server and updates the page over a socket.
What you will be able to do
- Use Phoenix.LiveView.
- Handle events with handle_event.
- Render with ~H sigil.
In plain English
LiveView keeps state on the server and updates the page over a socket.
- Use Phoenix.LiveView.
- Handle events with handle_event.
- Render with ~H sigil.
def mount(_params, _session, socket) do
{:ok, assign(socket, count: 0)}
end
def handle_event("inc", _, socket) do
{:noreply, update(socket, :count, &(&1 + 1))}
endYour turn
EasyExplain it back
Answer from memory: Where does LiveView keep state?
TEXT · starter
Your answer…Check your understanding before moving on.
Knowledge checkQuestion 1
Where does LiveView keep state?
Select an answer to continue
Study tools
Make it yours.
Keep a private note for this lesson, then turn the key ideas into flashcards you can revisit.
Sign in to save notes and flashcards.Both are private to your account and stay with your progress.
Sign inFinished reading?
Lock in what you just learned.
0%
Mark this lesson complete to save your place and move one step closer to the certificate.