React · Middle · Question 43 of 75

Why does TanStack Query, with default settings, refetch data when you return to the tab?

Explanation

By default, TanStack Query aggressively keeps data up to date: it's considered stale immediately and refetched on mount, window focus and network reconnect. If data rarely changes, increase staleTime globally or for a specific query.

Further reading

Problem with a question

React · Middle · question 43

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