React hooks for data fetching with axios. Version 0.4.0 is the latest stable release (last updated 2021). Provides auto-cancellation on unmount, caching (no-cache, cache-first, cache-and-network), polling, and callbacks (onSuccess, onError). Fully typed with TypeScript. Requires React 16.8+ and axios 0.21.1+. Differentiates from react-query and SWR by being a simple hook wrapping axios with minimal abstraction.
npm install use-axios-requestNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Simple GET request with loading and error states, caching omitted.
Memoize the config object with useMemo or useState.
Ensure config is stable or set pollInterval to 0 when not needed.
Wrap callbacks in useCallback or use refs.
Consider migrating to react-query or SWR for active support.
Move the hook inside a functional component.
Always call the hook at the top level, or handle conditional rendering with a wrapper component.