簡體   English   中英

React.js-即使我定義了數組也未定義

[英]React.js - array is undefined even when I defined it

我定義數組,在調試器和應用程序中始終未定義。 我沒有辦法調試它,只是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

即使調試dispatch和redux action,newArray也是未定義的...

我現在能做什么?

經過1個小時的調試,使用webpack進行重建,我將“ newArray”重命名為“ something”,現在發生了一些魔術之后,它就開始工作了。 而且不,我在函數定義的“ newArray”中沒有任何地方,我使用find進行過三遍檢查;)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM