use-axios-client
Basics
Getting Started

Getting started

Make axios requests in React using hooks.

  • Manages your request state so you can focus on building your UI
  • Accepts standard axios request config so writing requests feels familiar
  • Provides type definitions and generic functions so you can write typesafe code
  • No superficial "blazing fast" claims or esoteric emojis

# Installation

with npm:

$ npm install use-axios-client

with yarn:

$ yarn add use-axios-client

Note: Requires that you use React 16.8.0 or higher.

# Example

Here is a simple example of using the useAxios hook:

import { useAxios } from 'use-axios-client';
export default () => {
const { data, error, loading } = useAxios({
url: 'https://example/api',
});
return (
<>
{loading && <div>Loading...</div>}
{error && <div>{error.message}</div>}
{data && <div>{data}</div>}
</>
);
};