I have an object (equipmentTable) containing arrays of values for each column in a table. I am having trouble getting this table to render properly. I think I am pretty close.
Here is the object:
{
"manufacturer": [
"Google",
"Apple"
],
"modelNumber": [
"123456",
"36987"
],
"serialNumber": [
"889977",
"558877"
]
}
And what I have tried:
{equipmentTable &&
<table className="def-tbl">
<thead>
<th>Manufacturer</th>
<th>Model Number</th>
<th>Serial Number</th>
</thead>
<tbody>
{console.log(equipmentTable)}
{equipmentTable.manufacturer.map((value) => (
<tr>
<td>
{value}
</td>
</tr>
))}
{equipmentTable.serialNumber.map((value) => (
<tr>
<td>
{value}
</td>
</tr>
))}
</tbody>
</table>}
No matter what I try, everything renders in the first column.
Any help is appreciated!
<tr>s outside of themap()calls (though it looks like you'll need to access each prop value by index.)