Rendering an array.map() in React

前端 未结 9 1963
渐次进展
渐次进展 2020-12-04 11:17

I am having a problem where I am trying to use array of data to render a

    element. In the code below the console.log\'s are working fine,
9条回答
  •  北荒
    北荒 (楼主)
    2020-12-04 11:58

    import React, { Component } from 'react';
    
    class Result extends Component {
    
    
        render() {
    
               if(this.props.resultsfood.status=='found'){
    
                var foodlist = this.props.resultsfood.items.map(name=>{
    
                       return (
    
    
                       
    {name.item}
    Rs.{name.price}/=
    {name.description}

    ) }) } return (
      {foodlist}
    ) } } export default Result;

提交回复
热议问题