從react-virtualised的組件InfiniteLoader需要作爲屬性loadMoreRows傳遞的函數具有像{ startIndex: number, stopIndex: number }): Promise
這樣的簽名。 我使用終極版在我的項目,所以loadMoreRows
是一個終極版行動的創建者是這樣的:InfiniteLoader和react-redux
const fetchEntities(start, stop) {
return fetch(`${myUrl}&start=${start}?stop=${stop}`)
}
const loadMoreRows = ({ startIndex, stopIndex }) => {
return (dispatch, getState) => {
return function(dispatch) {
return fetchEntities(startIndex, stopIndex).then(
items => dispatch(simpleAction(items)),
error => console.log(error)
)
}
}
}
之後,這個動作連接反應使用連接從反應 - 終極版功能InfiniteLoader含成分。
所以我不知道,我怎麼能滿足簽名要求,因爲終極版動作製作者不返回任何值/
正如我從react-virtualised的源代碼中所理解的,它不需要從loadMoreRows函數返回Promise。儘管如果你不這樣做,你有義務調用child.forceUpdate()來更新底層組件。 – eyeinthebrick