React component wrapper for Axios that allows declarative HTTP requests inside render methods using child function callbacks. Current version 2.0.6 supports React 16-18, Axios ^0.27.2, and prop-types ^15.8.1. Features auto-cancel of previous requests, debounce, custom axios instances via AxiosProvider, and higher-order component withAxios. Alternative to react-query or SWR for simple data fetching, but lacks caching and background refetch capabilities. Release cadence is low (last major update 2022).
npm install react-axiosNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows basic use of Get component with child function callback for loading, error, and success states.
Ensure axios version is ^0.27.2, not v1.x. Use 'npm install axios@0.27.2'
Use <Get />, <Post />, etc. instead of <Request method='get'>
Always destructure in the correct order: first error, second response, third isLoading, etc.
Use react-query or SWR if caching or deduplication is needed
Provide a numeric debounce value, e.g., debounce={300}npm install react-axios
Use import { Get } from 'react-axios' instead of import Get from 'react-axios'Check if response is not null before accessing response.data: if (response) { ... }