Comparing
Promise based HTTP client for the browser and node.js
Hooks for managing, caching and syncing asynchronous and remote data in React
| Metric | axios | react-query |
|---|---|---|
| Ecosystem | npm | npm |
| Difficulty | Advanced | Beginner ✓ |
| Weekly downloads | 101.0M↑ | 1.6M |
| Latest version | v1.14.0 | v3.39.3 |
| Recipes | 7↑ | 1 |
axios only
Shared
react-query only
Use axios when you need request/response interceptors (auth headers, logging, retry logic), want automatic JSON serialisation/deserialisation, need to cancel in-flight requests, or want consistent behaviour between browser and Node.js environments.
Use React Query for any React app that fetches server data: REST APIs, GraphQL, or any async function. It replaces 95% of the useEffect+useState patterns for data fetching and adds caching, background refetching, and optimistic updates for free.
For simple requests in modern apps, fetch is built-in and perfectly adequate. For lightweight browser-only code, ky is a smaller alternative. React Query or SWR abstract data fetching further — prefer those when you also need caching and state management.
React Query is for server state (data that lives on a server). For UI state (modals, form values, local toggles), use useState or Zustand. If you're already using a full data layer like Apollo Client for GraphQL, React Query is redundant.
axios
+3 more
react-query