Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/lararosekelley/lib-react-hooks

General purpose React hooks library ⚛️
https://github.com/lararosekelley/lib-react-hooks

javascript mdx npm react react-hooks typescript

Last synced: 23 days ago
JSON representation

General purpose React hooks library ⚛️

Awesome Lists containing this project

README

        

# React Hooks Library

> General purpose React hooks library

---

[![npm version](https://badge.fury.io/js/lib-react-hooks.svg)](https://badge.fury.io/js/lib-react-hooks)
[![build status](https://travis-ci.org/tylucaskelley/lib-react-hooks.svg?branch=master)](https://travis-ci.org/tylucaskelley/lib-react-hooks)
[![coverage status](https://coveralls.io/repos/github/tylucaskelley/lib-react-hooks/badge.svg?branch=master)](https://coveralls.io/github/tylucaskelley/lib-react-hooks?branch=master)

## Installation

Install with `yarn`:

```bash
$ yarn add lib-react-hooks
```

Or, `npm` if you prefer:

```bash
$ npm install --save lib-react-hooks
```

## Usage

Simply import any hooks you want to use in your React component. Example using `useAsync`:

```js
import React from 'react';
import { useAsync } from 'lib-react-hooks';

const Component = () => {
const request = useAsync(async () => {
const response = await fetch('https://api.example.com/users/123');
return response.json();
});

return (


{request.complete ? (

{`Name: ${request.data.name}`}


) : (

Loading...


)}

);
};
```

## Available hooks

See the [documentation site](https://react-hooks-library.tlk.codes) for more.

## License

MIT License. See [LICENSE](./LICENSE) file for details.