How to loop an object in React?

后端 未结 5 1783
误落风尘
误落风尘 2020-11-30 02:28

New to React and trying to loop Object attributes but React complains about Objects not being valid React children, can someone please give me some advice on how to resolve

5条回答
  •  时光说笑
    2020-11-30 02:41

    You can use it in a more compact way as:

    var tifs = {1: 'Joe', 2: 'Jane'};
    ...
    
    return (
       
    )
    

    And another slightly different flavour:

     Object.entries(tifs).map(([key,value],i) => )  
    

提交回复
热议问题