I have an array of objects as output from API as below:
var x = [{
name: "test",
group: [{
name: "rating",
value: "55"
}]
},
{
name: "test1",
group: [{
name: "rating",
value: "20"
}]
},
{
name: "test2",
group: [{
name: "rating",
value: "60"
}]
},
{
name: "test3",
group: [{
name: "rating",
value: "10"
}]
}
]
<table>
<tr>
<td>test</td>
<td>test1</td>
<td>test2</td>
<td>test3</td>
</tr>
</table>
I am trying to change the color of all the rows of the table to green based on the object value x.group[0].value greater than 30. Any idea how can I achieve this? I am trying to group the arrays with the values greater than 30 but I am not sure how can I change color based on that.
for (var i = 0; i < x.length; i++) {
x[i].group[0].value
}
Note: I am using ReactJS. I created a Table component like this. I am not sure if I can change HTML much