I’ve been starting to work with Phoenix framework, I am currently following some LiveView tutorials. The tutorial that I am currently following has some syntax that is deprecated: Specifically when concatenating a string with an attribute in the attributes of an Html tag:
Old way:
def render(assigns) do
~H"""
<div id="post-<%= @post.id %>" class="post"></div>
"""
end
But with the above shows me the following compilation error:
.../post_component.ex:6:19: expected closing `"` for attribute value
Make sure the attribute is properly closed. This may also happen if
there is an EEx interpolation inside a tag, which is not supported.
Instead of
<div <%= @some_attributes %>>
</div>
do
<div {@some_attributes}>
</div>
How can I get the tag id as follows: "post-1"
?