我已經派人對象屬性爲什麼我越來越不確定的的console.log在reactJs
objValue = {
key1 = 'value1',
key2 = ['a','b','c','d','e'],
}
<childComponent objValue = {objValue} />
然後在我的孩子我試圖訪問屬性
class ....{
const {obj} = this.props.objValue,
console.log({obj.key2})
}
我錯過了什麼?
是啊我正在使用完全按照上面寫的,但它不工作 – palyxk
nope我越來越undefined,在parentComponent我清楚地看到整個對象,但當試圖訪問它的屬性與數組它不工作,但簡單的屬性,我可以訪問。我不明白我在做什麼錯誤 – palyxk
你在哪個地方使用'console.log'? –