react jsx 中的map 循环嵌套

jsx 中map 用的非常多,嵌套用到的也会很多!废话不多说,直接上代码

var btnType=Object.keys(obj).map((key,i)=>{  
    var item=obj[key].map((s,index)=>{  
      return (  
        <button className={styles.btnType} key={index}>{obj[key][index]}</button>  
      )  
    })  
    return(  
      <Card title={key} className={styles.marginB10} key={i}>  
        {item}  
      </Card>   
    )  
  })

猜你喜欢

转载自blog.csdn.net/shi851051279/article/details/79873425