State Management · Middle · Question 69 of 75

What does keepPreviousData: true do in SWR when the key changes (e.g. a new search query)?

Explanation

It avoids flashing an empty state while typing. Show a subtle indicator using isLoading/isValidating.

Further reading

Problem with a question

State Management · Middle · question 69

Test yourself

Take the State Management · Middle quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz