react-infinite-scroller
react-infinite-scroller copied to clipboard
"pageStart"cannot be initialized when i change tabs?
Describe the bug "pageStart"cannot be initialized
Expected behavior there are three tabs in my page. when i change tabs , "pageStart" should be initialized .
@EvalGitHub
I ran into the same issue.
And yes, it cannot be re-initialized to 0. I came up with a workaround: you can first set "hasMore" to false, then manually fetch the data from page 0.
Like this:
componentDidUpdate = (prevProps, prevState) => {
if (prevProps.filter !== this.props.filter) {
this.setState({ hasMore: false, posts: [] }, () => {
this.loadPosts(0);
});
}
};