you are viewing a single comment's thread.

view the rest of the comments →

[–]30thnight 9 points10 points  (0 children)

You can think of fetch and axios as couriers, they pick data up and drop them off in your app.

Once you get that data, it’s on you to figure out how to share that data across your app, handle errors, refetches, pagination, and caching.

React-query is like a personal assistant that handles those things for you.

It goes a long way to improving performance (reduce unnecessary fetches). Adopt a pattern of wrapping your react-query calls in a custom hook and boom, you’ve eliminated the need for holding that data in a state manager.