React-query and swr are awesome


React-query and swr are awesome. 🔥

They taught me to ask a bunch of questions that I should have been asking:

1. Should I cache data on the client for a certain period?
2. Should I load fresh data when the tab is refocused, or the network reconnects?

(1/x)
3. Should I retry failed HTTP calls?
4. Should I return cached data, then fetch fresh data behind the scenes?
5. Should I handle server cache separately from app state?
6. Should I avoid refetching recently fetched data?
7. Should I prefetch data the user is likely to want?
(2/x)
The answer to all these questions that I wasn’t asking: yes.

That's amazing. 🎉

I wanted a library to help with caching. But these libraries pointed out a dozen new ways for me to improve the user experience.

Love it. 👍

View original on X