Reactjs React Redux中出现奇怪错误“;无法读取属性forEach";

Reactjs React Redux中出现奇怪错误“;无法读取属性forEach";,reactjs,exception,redux,Reactjs,Exception,Redux,我有一个代码,它在react组件的mapstatetops函数中运行 model.relatedTables = relatedTables && _.mapValues(relatedTables, (attr, attrName) => { const tableSettings = { targetKey: model.getOuterKeyName(), ...attr, name: attrName, at

我有一个代码,它在react组件的
mapstatetops
函数中运行

model.relatedTables = relatedTables && _.mapValues(relatedTables, (attr, attrName) => { 
    const tableSettings = {
      targetKey: model.getOuterKeyName(),
      ...attr,
      name: attrName,
      attributeType: 'relatedTable'
    }

    [model.prototype, model.ItemClass.prototype].forEach(obj => {
      Object.defineProperty(obj, attrName, {
        get: getter(attrName, tableSettings),
        set: setter(attrName, tableSettings),
      })   
    })
  })
React抛出一个错误“无法读取未定义的每个属性”,指向代码的第二行

const tableSettings = {
显然,此行中没有任何
forEach
调用,即使在
model.getOuterKeyName()函数中也是如此

chrome浏览器中出现异常时暂停不起作用

在捕获的异常工作时暂停,并指向同一行

const tableSettings = {
单步执行
命令没有帮助
在这种情况下,我怎么能理解导致错误的神秘“forEach”呼叫在哪里?谢谢

对不起,是我的错,没有
,我不能使用方括号在数字括号后,因为系统认为它是一个表达式

} // here should be ;

[model.prototype, model.ItemClass.prototype]

或者在
数组中包装方括号数组初始化。从
方法

对不起,我的错,我不应该在没有
的情况下使用方括号在数字括号后,因为系统认为它是一个表达式

} // here should be ;

[model.prototype, model.ItemClass.prototype]
或者在
array.from
方法中用方括号括起数组初始化