A React hooks library for making Axios requests, providing a simple `useAxios` hook and a `useLazyAxios` hook for manual triggers. Current stable version 2.0.0, ships TypeScript types, requires React 16.8+ and Axios 0.19+. Key differentiator: minimal abstraction over Axios, supports dynamic URLs, request cancellation, and provides loading/error/data states out of the box.
npm install use-axios-clientNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Minimal React component using useAxios to fetch data from an API with loading, error, and success states.
Update code to use 'loading' instead of 'isLoading'.
Pass custom Axios instance as part of the config object, e.g., useAxios({ axios: customInstance, url: '...' }).Remove callbacks and use useEffect to react to data/error changes.
Remove any await from cancelRequest calls.
If you need fetch on mount, do not set 'manual: true'.
Use useAxios<MyDataType>({ url: '...' }) to get typed data.Upgrade to v2.0.0 and pass the Axios instance via config object: { axios: axiosInstance, url: '...' }.Correct import to: import { useAxios } from 'use-axios-client'.Import AxiosResponse from 'axios' instead.
Pass all options as a single object to useAxios.