use-axios

JSON →
library 1.0.0 ·javascript
verified Jun 7, 2026

A React hook that integrates axios with React Suspense for data fetching inside function component bodies. Version 1.0.0 is stable, uses a simple API mirroring axios parameters, and automatically caches responses globally across components. It offers both a throwing `useAxios` (for use with Suspense and Error Boundaries) and a safer error-handling `useAxiosSafe`, plus a `refetch` function to manually invalidate cached data. Requires React ≥16.8 and `axios` as a peer dependency. Its key differentiator is the Suspense-first design: no manual loading state management, with caching built in.