【React】遍历的两种方式

1、foreach(推荐)

  list.forEach((item)=>{
  
    });
eg:
 dataSource.forEach((item) => {
      const est = item.estimateAmount === null ? 0 : parseFloat(item.estimateAmount);
      const gmv = item.estimateGmv === null ? 0 : parseFloat(item.estimateGmv);
      allCountBudget += est;
      allCountGmv += gmv;
      // allCountGmv = parseFloat(allCountGmv) + parseFloat(gmv);
    });

2、map(内部不支持计算逻辑?)

list.map((item, index)=>
        <div>
          {item.name}
        </div> 
      )
    )