Json 使用ReactJS在if条件下返回值
我有以下代码块:Json 使用ReactJS在if条件下返回值,json,reactjs,if-statement,max,Json,Reactjs,If Statement,Max,我有以下代码块: <div className="max"> {Math.max.apply( Math, items.feeds.map(function(o) { const temp = 34; if(o.field1 <= temp) { return <b>{o.field1}</b>; //retu
<div className="max">
{Math.max.apply(
Math,
items.feeds.map(function(o) {
const temp = 34;
if(o.field1 <= temp) {
return <b>{o.field1}</b>; //return NaN
}
else {
return o.field1;
}
})
)}
</div>
{Math.max.apply(
数学
items.feed.map(函数(o){
常数温度=34;
如果(o.field1Math.max
返回一个数字:
返回值:给定数字中的最大值。如果
无法将参数转换为数字,返回NaN
您返回的是{o.field1}
-它无法转换为数字。请稍后使用
标记包装返回的数字。改用筛选器