State Management · Middle · Question 69 of 75
What does keepPreviousData: true do in SWR when the key changes (e.g. a new search query)?
- ✓Correct answer: Keeps showing the previous key's data until the new data arrives
- 2Stores all previous responses forever
- 3Prevents the key from changing
Explanation
It avoids flashing an empty state while typing. Show a subtle indicator using isLoading/isValidating.