React · Middle · Question 48 of 75

With pagination, how do you show the old page while the new one loads, instead of a skeleton?

Explanation

With a new key (['projects', page]), the query starts with an empty cache. placeholderData substitutes the previous data while the new data loads, and isPlaceholderData lets you, for example, disable the "Next" button. In v4 this was the keepPreviousData: true option.

Further reading

Problem with a question

React · Middle · question 48

Test yourself

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

Take this quiz