Move Phoenix.Component to separate file

Apologies for the dumb question but how do I move html content of Phoenix.Component to a separate html file ?
https://hexdocs.pm/phoenix_live_view/0.17.6/Phoenix.Component.html#content

defmodule MyComponent do
  use Phoenix.Component

  def greet(assigns) do
    ~H"""
    <p>Hello, <%= assigns.name %></p>
    """
  end
end

and I would like to move <p>Hello, <%= assigns.name %></p> to greetings.html.heex
As far as I see Phoenix.Component doesn’t have render function. So what do I need to use to return html from greet function ?

4 Likes

I don’t think you can do that for function components right now and from what I’ve read in the past it’s intended to work that way.