2.0.0 • Published 5 years ago

use-axios-client v2.0.0

Weekly downloads
1,447
License
MIT
Repository
github
Last release
5 years ago

CircleCI codecov License: MIT

Installation

with npm:

$ npm install use-axios-client

with yarn:

$ yarn add use-axios-client

Example

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>}
    </>
  );
};

Docs

Contributing

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