Different class name based on condition in React
if you're just trying to decide between number--high number--medium or '' based on the condition variable, then just make a helper function that does that

then do return &lt;div className={"number " + getNumberClass(condition)}}&gt;{number}&lt;/div&gt;