无法读取反应数据表错误中未定义的属性“映射”

在地图function中得到错误。

generateRows: function() { var cols = this.props.cols, // [{key, label}] data = this.props.data; 

获取数据错误(未定义值获取)

  return data.map(function(item) { // handle the column data within each row var cells = cols.map(function(colData) { // colData.key might be "firstName" return <td> {item[colData.key]} </td>; }); return <tr key={item.BlogId}> {cells} </tr>; }); }, 

既然你正在从道具上得到上校,为了确保它们存在于initialRender中,你可以添加一个支票,

  return data && data.map(function(item) { // handle the column data within each row return <tr key={item.BlogId}> {cols && cols.map(function(colData, index) { // colData.key might be "firstName" return <td key={index}> {item[colData.key]} </td>; })} </tr>; }); 

还为从内部映射函数返回的元素提供一个键