意外标记反应图()

问题描述:

**得到错误的ConsultantlistItem在反应JSX语法**意外标记反应图()

return this.props.userList.map(function(n,index){ 
       debugger 
       <ConsultantListItem key={index} {...n}/> 

      }); 

但是当我使用lodash

_.map(this.props.userList,function(userList,index) 
    { <ConsultantListItem key={index} {...userList} /> }); 

工作的罚款。

return语句必须在map函数内。这是你做错了什么。试试这个

{this.props.userList.map(function(n,index){ 
      return 
      <ConsultantListItem key={index} {...n}/> 

     });} 
+0

map函数必须返回一些东西。你的东西没有任何回报。而是你正在返回地图功能。尝试一次。 –