Fireblast - Html render with module components for Phoenix inspired by React

It is not that hard:

list = [1, 2, 3]

render_item = fn item ->
  ~E[<p><%= item %></p>]
end

~E[<div id="1"><%= Enum.map(list, render_item) %></div>]

You cannot use #{} in ~E as these are expanded in compile time, but you can always use <%= %>.

1 Like