Put in order · JavaScript and React course · Module 11: Data Fetching and APIs

SWR Pattern Lifecycle

Arrange the steps of the Stale-While-Revalidate pattern in order:

Items to put in order

  • Display cached data immediately (stale data)
  • User visits the page - check cache
  • Server returns fresh data - update cache and UI
  • Simultaneously send a request to the server (revalidate)

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