{"id":49614,"library":"use-axios-client","title":"use-axios-client","description":"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.","status":"active","version":"2.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/angelle-sw/use-axios-client","tags":["javascript","react","axios","hooks","xhr","http","typescript"],"install":[{"cmd":"npm install use-axios-client","lang":"bash","label":"npm"},{"cmd":"yarn add use-axios-client","lang":"bash","label":"yarn"},{"cmd":"pnpm add use-axios-client","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core HTTP client, required at runtime","package":"axios","optional":false},{"reason":"Peer dependency for React hooks","package":"react","optional":false},{"reason":"Peer dependency for React DOM","package":"react-dom","optional":false}],"imports":[{"note":"Library is ESM-only; named export, not default.","wrong":"const useAxios = require('use-axios-client')","symbol":"useAxios","correct":"import { useAxios } from 'use-axios-client'"},{"note":"Named export, not default.","wrong":"import useLazyAxios from 'use-axios-client'","symbol":"useLazyAxios","correct":"import { useLazyAxios } from 'use-axios-client'"},{"note":"Types are re-exported by Axios; use-axios-client does not export them.","wrong":"import { AxiosResponse } from 'use-axios-client'","symbol":"AxiosResponse","correct":"import { AxiosResponse } from 'axios'"}],"quickstart":{"code":"import React from 'react';\nimport { useAxios } from 'use-axios-client';\n\nconst App = () => {\n  const { data, error, loading } = useAxios({\n    url: 'https://jsonplaceholder.typicode.com/todos/1',\n    method: 'GET',\n  });\n\n  if (loading) return <div>Loading...</div>;\n  if (error) return <div>Error: {error.message}</div>;\n  return <div>Data: {JSON.stringify(data)}</div>;\n};\n\nexport default App;","lang":"typescript","description":"Minimal React component using useAxios to fetch data from an API with loading, error, and success states."},"warnings":[{"fix":"Update code to use 'loading' instead of 'isLoading'.","message":"In v2.0.0, the return value changed: 'loading' was renamed from 'isLoading' to 'loading'.","severity":"breaking","affected_versions":"2.0.0"},{"fix":"Pass custom Axios instance as part of the config object, e.g., useAxios({ axios: customInstance, url: '...' }).","message":"The hook no longer accepts an Axios instance as the first argument; instance must be passed via the config object as 'axios' key.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Remove callbacks and use useEffect to react to data/error changes.","message":"The 'onSuccess' and 'onError' callbacks are deprecated in favor of using useEffect with data/error.","severity":"deprecated","affected_versions":">=1.5.0"},{"fix":"Remove any await from cancelRequest calls.","message":"In v2.0.0, the 'cancelRequest' function no longer returns a promise; it returns void.","severity":"breaking","affected_versions":"2.0.0"},{"fix":"If you need fetch on mount, do not set 'manual: true'.","message":"The library does not support fetching on mount if 'manual' is set to true; it only fires when 'run' is called.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use useAxios<MyDataType>({ url: '...' }) to get typed data.","message":"When using TypeScript, the response data type is not inferred automatically; you must specify a generic type parameter.","severity":"gotcha","affected_versions":">=2.0.0"}],"env_vars":null,"search_vec":"'0.19':37 '16.8':34 '2.0.0':28 'abstract':41 'axio':3,11,36,43,59 'box':56 'cancel':48 'client':4 'current':25 'differenti':39 'dynam':45 'hook':7,17,21,60 'http':62 'javascript':57 'key':38 'librari':8 'loading/error/data':51 'make':10 'manual':23 'minim':40 'provid':13,50 'react':6,33,58 'request':12,47 'requir':32 'ship':29 'simpl':15 'stabl':26 'state':52 'support':44 'trigger':24 'type':31 'typescript':30,63 'url':46 'use':2 'use-axios-cli':1 'useaxio':16 'uselazyaxio':20 'version':27 'xhr':61","created_at":"2026-06-07T17:02:40.711737+00:00","updated_at":"2026-06-07T17:02:40.711737+00:00","problems":[{"fix":"Upgrade to v2.0.0 and pass the Axios instance via config object: { axios: axiosInstance, url: '...' }.","cause":"The library expects an Axios instance, often from a previous version's API where instance was passed directly.","error":"Cannot read properties of undefined (reading 'get')"},{"fix":"Correct import to: import { useAxios } from 'use-axios-client'.","cause":"Importing useAxios as default export instead of named export.","error":"TypeError: (0 , use_axios_client__WEBPACK_IMPORTED_MODULE_0__.useAxios) is not a function"},{"fix":"Import AxiosResponse from 'axios' instead.","cause":"Trying to import AxiosResponse from use-axios-client, but it's not exported there.","error":"error TS2304: Cannot find name 'AxiosResponse'"},{"fix":"Pass all options as a single object to useAxios.","cause":"In v2, the hook no longer accepts multiple arguments; all options go in one config object.","error":"Expected 0 arguments, but got 1."}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://use-axios-client.io","github":"https://github.com/angelle-sw/use-axios-client","docs":null,"changelog":null,"pypi":null,"npm":"use-axios-client","openapi_spec":null,"status_page":null,"smithery":null,"categories":["api"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}