-
React Query is a ReactJS preconfigured data management library which gives you power and control over server-side state management, fetching, and caching of data, and error handling in a simple and declarative way without affecting the global state of your application.
-
Server data is asynchronous – it can easily be outdated, this is because the data is not stored in your React application. This is where the Query library shines, to allow you to manipulate the asynchronous data, cache it, and also, update stale data or synchronize it.
- React Query is a big thing because it helps with server-state data management. This means that you no longer have to worry about keeping everything in a standard global state because most libraries were created to handle client state only and the server states are way different. React Query is good enough because this library will help you to fetch, synchronize, update, and cache your remote data while also reducing the amount of code you need to write by providing you two simple hooks and one utility function. With React Query, you do not need to write boilerplate codes to enable it to post with React as is the case with the other libraries.
- Ease of data fetching;
- It is becoming the standard way to fetch data;
- Highly customizable;
- Lightweight;
- deduping multiple requests for the same data into a single request;
- updating “out of date” data in the background (on windows focus, reconnect, interval, and so on);
- memoizing query results;
- mutations, which make it easy to implement optimistic changes.
- prefetching the data;
- performance optimizations like pagination and lazy loading data;