react map遍历,react native map遍历

 

  • react map遍历(截取部分重要代码)
{this.state.images.map((img, i) => {
    return (
        

Updated:{img.left ? img.left.date : img.right.date}

); })}

或者

            {this.props.socks &&
              this.props.socks.map((sock, i) => {
                let randomId = Math.round(Math.random() * 10000);
                let sockDiv = (
                  
                    {sock.mac}
                    {sock.sn}
                    {sock.authCode}
                    {sock.foot}
                  
                );
                return sockDiv;
              })}

 

  • react native map遍历(截取部分重要代码)

 

{this.props.forecastList && this.props.forecastList.daily_forecast && this.props.forecastList.daily_forecast.map((infor, i) => {
                    let weatherDiv =(
                        
                            
                                {infor[i]&&infor[i].date.split("-")[2]}日
                                今天
                            
                            
                                {(infor[i]&&infor[i].cond.txt_n) === "多云" ?  : null}
                                {infor[i]&&infor[i].cond.txt_n}
                            
                            
                                {infor[i]&&infor[i].tmp.min}~{infor[i]&&infor[i].tmp.max}℃
                            
                        
                    );
                    return weatherDiv
                })}

 

你可能感兴趣的:(前端)