从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