use-abortable-stream-fetch
TypeScript icon, indicating that this package has built-in type declarations

0.0.3 • Public • Published

use-abortable-stream-fetch

React hook for fetching streams that can be aborted.

Installation

yarn add use-abortable-stream-fetch

Usage:

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 <div>{data}</div>;
};
 
export default Logs;

Readme

Keywords

none

Package Sidebar

Install

npm i use-abortable-stream-fetch

Weekly Downloads

5

Version

0.0.3

License

MIT

Unpacked Size

105 kB

Total Files

12

Last publish

Collaborators

  • marconi