🔥 ok/1 & noreply/1 LiveView helpers!
Notes
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
and noreply/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 Web.live_view/0
function. Now, they’re automatically
included in all LiveViews! 🥳