简体   繁体   中英

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..

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...

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. And no I do not have anywhere in function defined "newArray" I tripple checked using find ;)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM