I am attempting to implement infinite scrolling functionality in our current application;
We first fetch the first 5 'Posts' for a page. Upon scrolling to the bottom of the page, we then fetch the next 5 Posts.
This works nicely, however using the same query means that the existing data (the first 5 posts) has been replaced by the new data.
Is it possible to merge the existing data with the new data?
I could merge them in place, for example with something like; const posts = [newPosts, oldPosts] but then we lose the data invalidation provided by RTK Query if the existing data is modified.
What is the recommended approach for this case?