83 words, 1 min read
I’m not a fan of writing
{:ok, socket}
and{:noreply, socket}
in all of my LiveViews. We can’t pipe into them!So, I typically introduce a couple of
ok/1
andnoreply/1
helpers in every single LiveView:def ok(socket), do: {:ok, socket} def noreply(socket), do: {:noreply, socket}
But it wasn’t until recently that a colleague of mine had the 💡 brilliant idea to add them to the Web module!
Just drop them in the
MyAppWeb.live_view/0
function. Now, they’re automatically included in all LiveViews! 🥳
continue reading on www.elixirstreams.com
⚠️ This post links to an external website. ⚠️
If this post was enjoyable or useful for you, please share it! If you have comments, questions, or feedback, you can email my personal email. To get new posts, subscribe use the RSS feed.