I am attempting to get API data to correctly display on a react-table. I
am able to get all data to display onto my localhost but some values are not needed. I am thinking that if I were to reference each array specifically, then it would work:
{objStationD.[""0""].Origin}
The bracket value is what the console says is its property path. I will post the array itself below as a reference point.
The following is my frontend code:
{this.state.data.map(objStationD =>
<Table dark>
<thead>
<tr>
<th>Origin</th>
<th>Due date</th>
<th>Destination</th>
<th>Due</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">{objStationD.[""0""].Origin}</th>
<td>{objStationD.Origintime}</td>
<td>{objStationD.Destination}</td>
<td>{objStationD.Duein}</td>
</tr>
</tbody>
</Table>
)};
This is a snippet of the array returned:
Array(4)
0:
Destination: ["Sligo"]
Origin: ["Dublin Connolly"]
Destinationtime: ["14:15"]
length: 1
__proto__: Array(0)
Origintime: ["11:00"]
1: {Servertime: Array(1), Traincode: Array(1), Stationfullname: Array(1), Stationcode: Array(1), Querytime: Array(1), …}
2: {Servertime: Array(1), Traincode: Array(1), Stationfullname: Array(1), Stationcode: Array(1), Querytime: Array(1), …}
3: {Servertime: Array(1), Traincode: Array(1), Stationfullname: Array(1), Stationcode: Array(1), Querytime: Array(1), …}
length: 4
__proto__: Array(0)
Originproperty in above array returned?objStationD[0].Origin?