0
tryingn的財產使用API調用來呈現列表視圖陣營本地無法讀取未定義
(rowData)=><CatalogCell newWidth={imgWidth} imgMargin =
{imgMargin}
url={rowData.product.name} price={rowData.price}/>
我可以正確讀取的價格,但如果我讀什麼超越的深度1,我得到這個錯誤,basiclly rowData.product不會給我任何東西,但如果我去rowData.product,它會顯示錯誤
了
Cannot read property 'name' of undefined
renderRow
CatalogList.js:74:114
StaticRenderer.render
StaticRenderer.js:32:22
<unknown>
ReactCompositeComponent.js:1218:19
measureLifeCyclePerf
ReactCompositeComponent.js:63:11
ReactCompositeComponentWrapper._renderValidatedComponentWithoutOwnerOrContext
ReactCompositeComponent.js:1217:24
ReactCompositeComponentWrapper._renderValidatedComponent
ReactCompositeComponent.js:1249:31
ReactCompositeComponentWrapper.performInitialMount
ReactCompositeComponent.js:499:29
ReactCompositeComponentWrapper.mountComponent
ReactCompositeComponent.js:346:20
Object.mountComponent
ReactReconciler.js:56:34
Constructor.mountChildren
ReactMultiChild.js:276:41
代碼來設置列表視圖數據:
componentDidMount(){
getCatalog((callback)=>{
console.warn(callback.result.data)
this.setState({
dataSource:this.state.dataSource.cloneWithRows(
callback.result.data
),
loading:false,
})
})
}
你可以console.log並告訴我什麼是數據rowdata獲得,也可以告訴我你如何設置值rowData – zenwraight