只想询问ReactJS是否可以这样做:
if(Response.text === 'Cancelled'){
//Change text color to red
}else{
//change to color green
}
由于
答案 0 :(得分:0)
答案 1 :(得分:0)
是它可以在所有javascript框架中使用。
对于ReactJS中的这种情况,你必须这样做:
<p style={{color: API_RESPONSE === 'Cancelled' ? 'red' : 'green'}}>
...
</p>
答案 2 :(得分:0)
可能
<div style={{color: Response.text === 'Cancelled' ? 'color1' : 'color2'}}>
//dosomthing
</div>