Why react-query / swr are awesome: They return cached data *immediately*,...


Why react-query / swr are awesome:

They return cached data *immediately*, then fetch behind the scenes and update the UI when it’s returned.

Result: Pages load *instantly* if cached data is available. If the cache is stale, users see fresh data a moment later.

Slick. 🔥
This makes a slow API feel MUCH faster. If a cached result is available, the response is instant because it's a local in memory cache.

Even if the cache is stale, the user sees data immediately. They see stale data for a moment until the call completes, which updates the UI.👍
There are many other great reasons to consider these libraries:

- refetch on focus
- developer ergonomics
- request cancellation
- suspense integration

If you're using plain fetch or Axios, you're missing out. Try react-query or swr. I bet you'll love either. I'm sold.

View original on X