The Pragmatic Studio

LiveView Course Update #11: Toggle State

July 23, 2020

Thanks for your continued interest in our Phoenix LiveView course!

One of the most rewarding parts of making this course has been hearing from you! Since our initial rollout, many of you have emailed asking:

  • How would I use LiveView to…?
  • What’s the best way to implement LiveView in a scenario like…?
  • You’re going to have a video on XYZ with LiveView, right? 😉

In large part due to your suggestions, our list of ideas and examples grows almost daily!

Others of you have emailed or tweeted us about what you’ve learned and how you’re now rolling LiveView into production apps.

"I've been writing Elixir for a few years and had a hard time wrapping my mind around the LiveView programming model. Your course gave me the know-how and confidence to get a couple of LiveViews configured and running in our production Phoenix app!" — Matthew Lehner

That’s awesome! If you have an external-facing app that uses a LiveView feature, we’d love to hear about it. Perhaps we can even show it off for you in our next update. Together we can inspire each other with new ideas.💡

Example #12: Toggling State

On or off? Pending or completed? Draft or published? Your UI often needs a quick and easy way to toggle a bit of state.

In our volunteers example, you can currently check in but you can’t check out. It’s a bit like the Eagles’ song “Hotel California” 😳

Last thing I remember
I was running for the door
I had to find the passage back
To the place I was before
"Relax," said the night man
"We are programmed to receive
You can check out any time you like
But you can never leave"

In this week’s new video, we let volunteers toggle their state between checked in and checked out, and then actually leave!

If you’ve already picked up a copy of the course, you’ll find this new video along with a new exercise in your account today. And we’re so on the ball this week that the video already has subtitles! 😁

In the next video we’ll publish real-time updates across multiple browser sessions. Stay tuned!