我有一个像下面这样的 span 元素,我想根据它的值更改 count_variable 颜色。
render = () => {
const count_variable = this.get_count(); //this function returns an
//integer variable
return (
<div>
<span>counter</span>
<span>{count_variable}</span>
</div>
)
}
例如,输出如下所示,count 0
现在当这个 count_variable
value is 0 i want its color to be red
value is 1 want its color to be blue
value is greater than 1 its color to be green
我该怎么做。有人可以帮我解决这个问题。谢谢。
FFIVE
精慕HU
森林海
胡说叔叔
相关分类