State Management · Middle · Question 31 of 75
With pagination, how do you keep showing the previous page while the next one loads?
- ✓Correct answer:
placeholderData: keepPreviousData - 2
staleTime: Infinity - 3
refetchOnMount: false
Explanation
A new key (['projects', page]) starts with an empty cache. placeholderData shows the previous data meanwhile, and isPlaceholderData lets you disable the "Next" button.