The difference between React Query and Zustand - Food service analogy

In a nutshell, React Query fetches and caches stuff, while Zustand does more local state management.

Zustand is like a bartender always at the bar to serve customers (in tech-speak - manage state). React Query is more like a food runner who fetches food from the back (fetches data from the backend). They both serve customers but serve different items in different ways.

They also keep their things (aka data) in different places: alcohol in one place and food in another. Zustand keeps data one place (plain JavaScript object - called the store in the course), and React Router another (in a cache).

1 Like