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: 2 months ago
JSON representation

React hook for fetching streams that can be aborted.

Lists

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;
```