# react-fnr

> Fetch with Axios and render

Latest version **1.0.9** (published 2018-02-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-fnr
pnpm add react-fnr
yarn add react-fnr
bun add react-fnr
```

## 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.9 |
| Published | 2018-02-22 |
| First published | 2018-02-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 210.2 KB |
| Known vulnerabilities | 0 (+25 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Hosein Khansari |
| Maintainers | hkh12 |
| Keywords | react, axios, fetch |

## Links

- npm: https://www.npmjs.com/package/react-fnr
- Repository: https://github.com/hkh12/react-fnr
- Homepage: https://github.com/hkh12/react-fnr#readme
- Issues: https://github.com/hkh12/react-fnr/issues
- npm.io page: https://npm.io/package/react-fnr

## Dependencies (4)

- [axios](https://npm.io/package/axios.md) ^0.17.1
- [react](https://npm.io/package/react.md) ^16.2.0
- [react-dom](https://npm.io/package/react-dom.md) ^16.2.0
- [react-proptypes-url-validator](https://npm.io/package/react-proptypes-url-validator.md) 0.0.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.0.9 (latest) — 2018-02-22
- 1.0.8 — 2018-02-22
- 1.0.7 — 2018-02-20
- 1.0.6 — 2018-02-20
- 1.0.5 — 2018-02-19
- 1.0.4 — 2018-02-19
- 1.0.3 — 2018-02-19
- 1.0.1 — 2018-02-19
- 1.0.0 — 2018-02-19
- 0.1.1 — 2018-02-18
- 0.1.0 — 2018-02-18

## README

# react-fnr
react-fnr is a tool for making http requests with Axios and render the result, error and more.
## Installation
Using npm:
```shell
npm install react-fnr
```
Using yarn:
```shell
yarn add react-fnr
```
## Testing
After installing, just run:
```shell
npm start
```
Or if you are using yarn:
```shell
yarn run start
```
navigate to http://localhost:12210 to see a test.
## Importing
Requiring module:
```javascript
// es6
import FNR from 'react-fnr';
// es5
const FNR = require('react-fnr');
```
Using HTML `script` tag:
```html
<!-- Use this for production -->
<script src="https://cdn.rawgit.com/Hkh12/react-fnr/80815e49/umd/react-fnr.min.js"></script>
<!-- And this one for development -->
<script src="https://rawgit.com/Hkh12/react-fnr/master/umd/react-fnr.min.js"></script>
```
## Example Code
```javascript
import React from 'react';
import FNR from 'react-fnr';

const Example = (props) => {
    return (
        <FNR url={props.url} method='get' component={
            (data) => {
                return <p>{data}</p>
            }
        } loadingComponent={
            () => {
                return <div>Loading...</div>;
            }
        } errorComponent={
            () => {
                return <div>An error occurred. please try again later.</div>;
            }
        } />
    );
}
```
## Reference
| name | description | type | default value | required |
| -- | -- | -- | -- | -- |
| `url` | url to send request to | `string (url)` | - | ✔️ |
| `method` | request method | `get, post, head, connect, put, patch, delete, options, trace` | `get` | ❌ |
| `component` | Component should be rendered after the server response | `PropTypes.element, PropTypes.func` | - | ✔️ |
| `loadingComponent` | Component should be rendered before the server response (loading message) | `PropTypes.element, PropTypes.func` | - | ❌ |
| `errorComponent` | Component should be rendered if there was any error in request (if the status code us not 200) | `PropTypes.element, PropTypes.func` | - | ❌ |
| `config` | axios config for request (url, method and data are overridden!)  | `object` | `{}` | ❌ |


## License
[MIT](https://github.com/Hkh12/react-fnr/blob/master/LICENSE)

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