# Reply-Function for LiveViews

**URL:** <https://forum.elixirforum.com/t/reply-function-for-liveviews/61534>\
**Category:** Proposals: Ideas\
**Tags:** phoenix, liveview, mount\
**Created:** [February 8, 2024, 1:39pm UTC](https://forum.elixirforum.com/t/reply-function-for-liveviews/61534 "2024-02-08T13:39:37Z")\
**Posts on this page:** 1\
**Showing post:** 17

<div class="post-metadata">

**Author:** ![lkuty](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/lkuty/32/34879_2.png) [@lkuty](https://forum.elixirforum.com/u/lkuty)\
**Post date:** [February 14, 2024, 4:16pm UTC](https://forum.elixirforum.com/t/reply-function-for-liveviews/61534/17 "2024-02-14T16:16:37Z")

</div>

I agree and did something similar to make the code easier to read IMO. Some might have objections because it adds special conventions to the code base but it works well for me. Especially the `noreply/1` which is super simple.

```elixir
def ok(value, extra \\ nil)
def ok(value, nil), do: {:ok, value}
def ok(value, extra), do: {:ok, value, extra}
def error(reason), do: {:error, reason}
def reply(state, res), do: {:reply, res, state}
def noreply(state), do: {:noreply, state}

```

---

_[View the full topic](https://forum.elixirforum.com/t/reply-function-for-liveviews/61534)._
