React中使用遍历

1、使用for(let item of items){}

render(){
    var itemList = []
    for(let item of items){
        itemList.push(<Item item={item}/>)
    }
    return(
        {itemList}
    )
}

2、使用map

render(){
    return(
        {items.map((item) =>{
            return(
                <Item item={item}/>
            )
        }
    )
}
原文地址:https://www.cnblogs.com/zoeeying/p/10891950.html