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

前端 未结 2 1745
孤城傲影
孤城傲影 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条回答
  •  南笙
    南笙 (楼主)
    2021-02-07 11:17

    Try forEach method instead of map:

       var WholeNews =[];
       tmp_array.forEach(function(news, i){
          WholeNews.push(
            
              {news.headline}
              
                {news.text}
              
            );
        });
    

    And note from where you can get the i index..

提交回复
热议问题