Question · JavaScript and React course · Module 10: React Ecosystem and Future

The stale-while-revalidate Pattern

What is the stale-while-revalidate strategy used by React Query?

Answer options

  • Data is fetched only once and never refreshed
  • Cached data is immediately displayed (stale), while a refresh is performed in the background (revalidate) - when new data arrives, the UI updates
  • Cache is cleared after every query to always have fresh data
  • Data is always fetched from the server, never from cache

You can check the correct answer by solving this task in the CodeWorlds game.