React native mapping through array with object childs - working different as in react web?

前端 未结 2 1741
孤城傲影
孤城傲影 2021-02-07 10:43

I have this array which contains objects:

var tmp_array = [
 { headline: \"Test\", text: \"Test text\", send_at: \"test date\" }
];

Now in the

2条回答
  •  -上瘾入骨i
    2021-02-07 11:20

    This should work:

    WholeNews() {
      return tmp_array.map(function(news, i){
        return(
          
            {news.headline}
            
              {news.text}
            
          
        );
      });
    }
    
    render() {
      return(
        
          {this.WholeNews()}
        
      )
    }
    

提交回复
热议问题