Currently the phx.gen.live
tasks do not create 0.16 Phoenix.Component modals - what gets generated is still using :live_component
.
I know it’s pretty early so that’s fine. I’m trying to learn 0.16 by converting it, and I’ve hit a wall.
The mix task typically does CRUD by creating a modal logic.
Now I’ve made changes so that it’s using 0.16 components for rendering.
My question is at this point:
~H"""
<div>
... modal code ...
<%= component @component, @opts %>
</div>
I understand that @component
has to be a 1-arity render function.
What the example had in (sigil_H
)[Phoenix.LiveView.Helpers — Phoenix LiveView v0.16.0] was when you had the ~H
usage inside a module.
Well then, how do you pass in a component to component/2
which has its counterpart .heex
file?
Do I pass a rendering function of that component module - one that takes in an assign, and then run render/2
inside that function? Seems too roundabout for me - so I don’t think that’s it.
Thanks in advance. Excited to work with 0.16!