Skip to content
This repository has been archived by the owner on Mar 22, 2023. It is now read-only.

miguelteixeiraa/useStreamingState

Repository files navigation

useStreamingState

How to use

  1. yarn add -D use-streaming-state
import { useStreamingState } from 'use-streaming-state'

useStreamingState(
    {
        reqInfo: 'http://localhost:8080',
        reqInit: {
            method: 'POST',
            body: new FormData()
        },
        streamBuffer: true,
        dataSeparator: '\\n'
    },
    (state) => {
        console.log('incoming data from streaming', state)
    }
)

About

Hook to read data from a streaming API

Resources

License

Stars

Watchers

Forks