Question · JavaScript and React course · Module 11: Data Fetching and APIs

Cache Invalidation

When should you 'invalidate' (delete/refresh) the cache in a React application?

Answer options

  • Never - the cache should be permanent and never expire
  • Only when closing the browser
  • After mutation operations (POST, PUT, DELETE) that change data on the server
  • Every 5 seconds, regardless of user actions

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