Livecomponent: assign @value not available in eex template. Why such behaviour?

You are right and I did some more research and found an example where the live_component declares its own values:

So it is possible and my conclusion was mostly based on the fact that there are not any examples of this usage.
The reason for which it didn’t work in my project was my fault. I copy pasted the mount definition from my LiveView in my component. However, there is a subtle difference in the mount function for the LiveView and the one for the LiveComponent.

LiveComponent:
def mount(socket) do

LiveView:
def mount(_session, socket) do

So my mount definition was wrong and the value was never added to the assigns.

Thanks to everyone who took the time to help me.

4 Likes