LiveView render hook for derived assigns - suggested approaches?

In LiveView “assigns” are state stored in the server.

The bare building blocks you have are a module and functions (thankfully only two concepts).

The LiveView “as a whole” (~page) is a module, all logic goes into functions.

The framework will call callbacks that you implement on your module: mount, handle_*, etc.

The way I approach derived assigns is computing them as a function of their dependencies (often a private function defp inside the module and called as appropriate).

You can as well inline your templates in your LiveView module, def render(assigns), and then you can do as you wanted/saw in function components as in the CoreComponents module.

Note you need to be careful to follow the rules with regards to change tracking: common pitfalls.