Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/sumgwork/react-custom-hooks

Custom react hooks
https://github.com/sumgwork/react-custom-hooks

Last synced: about 1 month ago
JSON representation

Custom react hooks

Awesome Lists containing this project

README

        

# react-custom-hooks

> Useful list of custom React hooks

[![NPM](https://img.shields.io/npm/v/@sgovil/react-custom-hooks)](https://www.npmjs.com/package/@sgovil/react-custom-hooks)
[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
[![demo site](https://img.shields.io/badge/demo-site-green)](https://sumgwork.github.io/react-custom-hooks/)

## Install

```bash
npm install --save @sgovil/react-custom-hooks
```

## Usage

```jsx
import React from "react";
import useFetch from "@sgovil/react-custom-hooks";

export default function App() {
const [response, error, loading] = useFetch(
"https://jsonplaceholder.typicode.com/todos"
);
return (


React Custom Hooks

{loading &&

Loading...
}
{!loading && error &&
{error.message}
}
{!loading && !error && response && (

Fetch Complete


{JSON.stringify(response, undefined, 2)}


)}

);
}
```

## License

MIT © [sumgwork](https://github.com/sumgwork)

---

This hook is created using [create-react-hook](https://github.com/hermanya/create-react-hook).