# react-easy-fetch

> Easy React component wrapper for axios

Latest version **1.1.1** (published 2022-04-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-easy-fetch
pnpm add react-easy-fetch
yarn add react-easy-fetch
bun add react-easy-fetch
```

## Health

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

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.1 |
| Published | 2022-04-18 |
| First published | 2022-04-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 6.8 KB |
| Known vulnerabilities | 0 (+23 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Sebastian Korotkiewicz |
| Maintainers | skorotkiewicz |
| Keywords | react, component, axios, fetching |

## Links

- npm: https://www.npmjs.com/package/react-easy-fetch
- Repository: https://github.com/skorotkiewicz/react-easy-fetch
- Homepage: https://github.com/skorotkiewicz/react-easy-fetch#readme
- Issues: https://github.com/skorotkiewicz/react-easy-fetch/issues
- Funding: https://paypal.me/skorotkiewicz
- npm.io page: https://npm.io/package/react-easy-fetch

## Dependencies (1)

- [axios](https://npm.io/package/axios.md) ^0.26.1

## 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.1.1 (latest) — 2022-04-18
- 1.1.0 — 2022-04-17

## README

# react-easy-fetch

> Easy React component wrapper for axios

## Install

```
yarn add react-easy-fetch
// or
npm i react-easy-fetch
```

## Props

| prop      | default |   type |
| --------- | :-----: | -----: |
| url       |         | string |
| params    |   {}    | object |
| method    |  "get"  | string |
| data      |   {}    | object |
| options   |   {}    | object |
| onSuccess |         |   void |
| onError   |         |   void |

## Example

```jsx
import { EasyFetch } from "react-easy-fetch";

const App = () => {
  const handleSuccess = (data) => console.log(data);
  const handleError = (error) => console.log(error);

  const Posts = (props) => {
    console.log(props.response);
    return <div>{props.isLoading && "Loading..."}</div>;
  };

  return (
    <EasyFetch
      url="https://jsonplaceholder.typicode.com/posts"
      method="post"
      params={{ posts: 1 }}
      data={{ post: 1, user: 2 }}
      options={{
        headers: { "X-Custom-Header": "value" },
      }}
      onSuccess={(data) => {
        console.log("onSuccess");
        handleSuccess(data);
      }}
      onError={(error) => {
        console.log("onError");
        handleError(error);
      }}
    >
      <Posts />
    </EasyFetch>
  );
};
```

---
_Source: https://npm.io/package/react-easy-fetch · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
