0
我試圖做一個無限的滾動邏輯,我在componentWillReceiveProps
中這樣做,但沒有看到我的列表正確渲染?將新陣列合併到componentWillReceiveProps狀態
componentWillReceiveProps(nextProps) {
if(!isEqual(nextProps.listItems, this.state.listItems)){ //user scrolled, call next offset using the API
this.setState({
listItems: this.state.listItems.push(...nextProps.listItems)
})
}
}