[英]React.js - array is undefined even when I defined it
I define array and in debugger and in app it is always undefined. 我定义数组,在调试器和应用程序中始终未定义。 I have no way how to debug this, simply javascript is not working as it should.. 我没有办法调试它,只是javascript无法正常工作。
let newArray=[];
for (let i in data) { ///newArray is undefined
const newData = update(data[i],
reactID: {$set: this.reactID}
});
newArray.push(newData); ///newArray is undefined
this.reactID++;
}
dispatch(actions.change("model.records",newArray)); ///newArray is undefined
Even debugging dispatch and redux action , newArray is also there undefined... 即使调试dispatch和redux action,newArray也是未定义的...
What can I do now? 我现在能做什么?
After 1 hours of debugging , rebuilding with webpack I renamed "newArray" to "something" and now after some magic happend it is working. 经过1个小时的调试,使用webpack进行重建,我将“ newArray”重命名为“ something”,现在发生了一些魔术之后,它就开始工作了。 And no I do not have anywhere in function defined "newArray" I tripple checked using find ;) 而且不,我在函数定义的“ newArray”中没有任何地方,我使用find进行过三遍检查;)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.