I want to display the dynamic key and its value in a table using reactjs
Actual EC: "2.5"
Actual pH: "6"
location: "Substrate"
Above is the data from API. There is Actual EC and Actual PH. But in table i want to display like this
EC:2.5
ph:6
How to display ? I have stored those API data in state like this:
this.setState({
prod_dashboard: data.params
})
Here is the render:
{this.state.prod_dashboard && this.state.prod_dashboard.map((st, i) => (
<Col lg="3" key={i}>
<Card className="task-box" style={{ backgroundColor: 'black' }}>
<CardBody>
<div className="table-responsive">
<table className="table-nowrap mb-0" style={{ color: "yellow" }}>
<tbody>
<tr>
{st.location !== "" ?
<th scope="row">{st.location} :</th>
:""}
<td style={{ paddingLeft: "20px" }}>{st["Actual EC"]}</td>
</tr>
</tbody>
</table>
</div>
</CardBody>
</Card>
</Col>
))}