Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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: 29 days ago
JSON representation
General purpose React hooks library ⚛️
- Host: GitHub
- URL: https://github.com/lararosekelley/lib-react-hooks
- Owner: lararosekelley
- License: other
- Created: 2014-09-08T17:56:47.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2023-01-26T16:02:30.000Z (almost 2 years ago)
- Last Synced: 2024-07-07T00:29:49.342Z (4 months ago)
- Topics: javascript, mdx, npm, react, react-hooks, typescript
- Language: TypeScript
- Homepage: https://react-hooks-library.tlk.codes
- Size: 5.42 MB
- Stars: 143
- Watchers: 5
- Forks: 2
- Open Issues: 14
-
Metadata Files:
- Readme: README.md
- Contributing: .github/CONTRIBUTING.md
- License: LICENSE
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.