https://github.com/eperedo/fetch-hooks
https://github.com/eperedo/fetch-hooks
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/eperedo/fetch-hooks
- Owner: eperedo
- License: mit
- Created: 2019-07-09T19:04:37.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2019-09-01T19:40:15.000Z (over 5 years ago)
- Last Synced: 2025-02-07T23:27:20.094Z (4 months ago)
- Language: JavaScript
- Size: 166 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
> Use the fetch API with react hooks
### Instalation
```bash
yarn add @eperedo/fetch-hooks
``````bash
npm install @eperedo/fetch-hooks
```### Usage
```js
import React from 'react';
import { useFetch } from 'fetch-hooks';const url = 'https://jsonplaceholder.typicode.com/users/1';
function UserProfile() {
const [{ data: user, loading }] = useFetch({ url });if (loading) {
returnLoading User Profile...;
}return
{data.name}
;
}export default UserProfile;
```