with npm:
$ npm install use-axios-client
with yarn:
$ yarn add use-axios-client
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>}
</>
);
};
Clone the repository:
$ git clone https://github.com/angelle-sw/use-axios-client
Install dependencies:
$ yarn
Run the example app at http://localhost:8080:
$ cd example
$ yarn
$ yarn start
Run tests using jest:
$ yarn test