React & HTML: Highlight a table cell with booleans

I’m using React, and was wondering wether it is possible to highlight a table cell with a boolean, kind of this here:

    <td {if (highlight)  bgColor = 'red'} >Emil</td>

(Where highlight is a boolean state variable).


Yes, you can. Simply use a ternary operator for that:

<td style={{backgroundColor: highlight ? 'red' : ''}} >Emil</td>