State Management · Senior · Question 52 of 75
How do you implement infinite scrolling with a single RTK Query cache entry?
- ✓Correct answer: Use
serializeQueryArgsto ignore the page,mergeto append new pages andforceRefetchwhen the page changes - 2Create a new endpoint per page
- 3Store pages in a separate slice and concatenate in components
Explanation
By default each argument (page) gets its own cache entry. These options combine them into one growing list; newer RTK versions also offer infinite query endpoints.