# @nooks-practice/use-axios

> React Hook to use Axios

Latest version **1.0.2** (published 2020-12-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install @nooks-practice/use-axios
pnpm add @nooks-practice/use-axios
yarn add @nooks-practice/use-axios
bun add @nooks-practice/use-axios
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2020-12-25 |
| First published | 2020-12-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 3.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Margot |
| Maintainers | margot_k |
| Keywords | react, react-hooks, axios, hooks |

## Links

- npm: https://www.npmjs.com/package/@nooks-practice/use-axios
- Repository: https://github.com/imtherealk/nooks-practice
- Homepage: https://github.com/imtherealk/nooks-practice#readme
- Issues: https://github.com/imtherealk/nooks-practice/issues
- npm.io page: https://npm.io/package/@nooks-practice/use-axios

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.0.2 (latest) — 2020-12-25
- 1.0.1 — 2020-12-25
- 1.0.0 — 2020-12-25

## README

# @nooks-practice/use-axios

React Hook to use Axios

## Installation

#### yarn

`yarn add @nooks-practice/use-axios`

#### npm

`npm i @nooks-practice/use-axios`

## Usage

```js
import React from "react";
import useAxios from "@nooks-practice/use-axios";

function App() {
  const { loading, data, error, refetch } = useAxios({
    url: "https://yts-proxy.now.sh/list_movies.json"
  });

  return (
    <div className="App">
      <div className="content">
        <h1>{!loading && data && data.status}</h1>
        <h2>{loading && "loading"}</h2>
        <div>{error && error.message}</div>
        <button onClick={refetch}>Refetch</button>
      </div>
    </div>
  );
};
```

### Arguments

| Argument     | Type          | Description                                                                             | Required |
| ------------ | ------------- | --------------------------------------------------------------------------------------- | -------- |
| options      | object        | [Config options for Axios requests](https://www.npmjs.com/package/axios#request-config) | yes      |
| axiosInstance| AxiosInstance | Customized axios instance (or default axios instance)                                   | no       |

### Return

| Return value | Type      | Description                                                     | Default value |
| ------------ | --------- | --------------------------------------------------------------- | ------------- |
| loading      | boolean   | A boolean representing if response is loading or not            | true          |
| error        | object    | Axios error                                                     | null          |
| data         | object    | Axios response data                                             | null          |
| refetch      | function  | Function to refetch data                                        |               |

---
_Source: https://npm.io/package/@nooks-practice/use-axios · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
