How to increment ID inside a <%= for %> view helper

Viewed 98

I have this in my code:

<%= for empresa <- @empresas do %>
    <%= render myProject.ComponentView, "smallPlacard.html",
        smallPlacard_id: "1",
        smallPlacard_class: "Company",
        smallPlacard_mainText: company.name
    %>
 <% end %>

I would like that the smallPlacard_id would be automatically incremented for each rendered element. What's the best way of doing it in a Phoenix/functional way?

2 Answers
Related