by dbetteridge · 3y ago · 0 comments
react-query has hook wrappers that allow accessing data you've fetched once across multiple components.
Calling the refetch in one will update all components using that data.
It's clean and minimises the need to think about shared state
Of all of the SPAs I've worked on, 90%+ of the "state" is just server side data, pulled down via APIs, to display to the user. Other state libs don't bother to take into account common things like cache invalidation, or loading states, but it's all built in to React Query.