Today I Learned

hashrocket A Hashrocket project

HEEx Templates in Phoenix Live View

Phoenix LiveView will release a new template HEEX in the next version 0.16.0. With that we can create reusable view components like:

defmodule MyComponent do
  use Phoenix.Component

  def btn(assigns) do
    ~H"""
    <button class="btn"><%= @text %></button>
    """
  end
end

Then using like:

<MyComponent.btn text="Save">

So cool!

See More #elixir TILs
Looking for help? At Hashrocket, we 💜 Elixir! From our many Elixir client projects, to sponsoring the Chicago Elixir Meetup, to the source code for this application, we are invested in this community. Contact us today to talk about your Elixir project.