Hacker News new | ask | show | jobs
by dceddia 2239 days ago
If you want a lightweight cache, check out react-query[0]. It's a nice abstraction around fetching data, and it handles caching out of the box, as well as refetching data when the browser regains focus and a lot of other nice things.

0: https://github.com/tannerlinsley/react-query

1 comments

Thanks, I'll check it out.

I find using apollo's graphql client library solves this reasonably well too, though the syntax is a bit clunky and knowing when you need to explicitly define a cache function or not is tricky.