M
M
mosikus2019-11-05 11:09:20
React
mosikus, 2019-11-05 11:09:20

How to make a separator when outputting an array so that it doesn't appear below the last element?

I am outputting an array and I want to have a separator under each cell. But the problem is that it also appears under the bottommost object. How to fix it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0xD34F, 2019-11-05
@mosikus

{thematics.map((thematic, i, a) => (
  <div>
    <div style={style1} key={thematic.id}>
      {thematic.id}
    </div>

    {i < a.length - 1 ? <div style={style2} /> : null}
  </div>
))}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question