How to embed LiveView component in DeadView(Regular View)

Hello Phoenix Gurus,
Is it possible to render or embed LiveView components with in Regular Page View? If yes, pls share the how-to-do snippets. Appreciate your help and support.

Thanks
Senthil

You cannot render a live component inside a normal view, only within a live view. However there are phoenix components (stateless) that can be rendered in both (Dead and Live)

Thank you.

Hey @racksen, consider marking your question as resolved if it helped.

@mcrumm was recently teasing something that might be relevant…? https://twitter.com/mcrumm/status/1446114074798952452

Not directly relevant, but I think it will be something folks will find helpful. I will talk more about that at ElixirConf next week (and online after my talk!) :slight_smile:

@racksen you could also use live_render/3 from a Controller/View to render an inline LiveView, and within that you can render LiveComponents. However I would only do this as a stop-gap while moving toward a proper live route mounted at the router.

Otherwise use functional components as @tomkonidas solution stated.

4 Likes