I have a table being populated by rows mapped by an array. I want to have an expanded view (or div) of data when I click a button in that row. I run into an issue where I can't have two table rows in the same .map iteration.
I'm thinking there are multiple ways of doing this.
I could swap a table row for a row that spans the width of the table with a div inside of it, using an if statement tied to the id the of the event I want to expand.
I could jquery a div underneath the table row (not sure how to accomplish this).
<tbody className={loading}>
{this.state.events.map((event, id) =>
<tr key={event.id}>
<td>{event.data || ' '}</td>
<td>{event.otherData}</td>
<td><TimeStamp time={event.timestamp} /></td>
<td><button onClick={() => this.onShowInfo(event)}>
<i className="fa fa-search-plus" /></button></td>
</tr>
)}
</tbody>
JSX makes it impossible to have two rows rendered in a map function