Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/marconi/use-abortable-stream-fetch
React hook for fetching streams that can be aborted.
https://github.com/marconi/use-abortable-stream-fetch
Last synced: about 2 months ago
JSON representation
React hook for fetching streams that can be aborted.
- Host: GitHub
- URL: https://github.com/marconi/use-abortable-stream-fetch
- Owner: marconi
- License: mit
- Created: 2019-03-01T16:40:14.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2019-03-04T07:58:32.000Z (almost 6 years ago)
- Last Synced: 2024-11-16T09:19:52.625Z (about 2 months ago)
- Language: TypeScript
- Size: 53.7 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-react-hooks - use-abortable-stream-fetch - React hook for fetching streams that can be aborted. (Packages)
README
# use-abortable-stream-fetch
React hook for fetching streams that can be aborted.
### Installation
```bash
yarn add use-abortable-stream-fetch
```### Usage:
```javascript
import React, { useEffect } from 'react';
import useAbortableStreamFetch from 'use-abortable-stream-fetch';const Logs = () => {
const url = '...';
const { data, error, abort } = useAbortableStreamFetch(url);useEffect(() => {
dispatch(actions.processData(data));
}, [data]);return
{data};
};export default Logs;
```