Change the table cell color based on the value with react

Below is the sample code for change the table cell color based on the value

Sample code

<style>

.red{ background-color : red}

.green{background-color : green}

.orange{ background-color : orange}

</style>

<table>

<tr>

<td class='{ score >50 ? ‘green’ : score >35 ? ‘orange’ : ‘red’ }’>60</td>

</tr>

Leave a Comment