Rendering live component to HTML

Phoenix.LiveView.Rendered implements the Phoenix.HTML.Safe protocol, so you can do it like this:

MyComponent.greet(%{name: "hello"})
|> Phoenix.HTML.Safe.to_iodata()
|> to_string()

References:

5 Likes