1.1.8 • Published 3 years ago
react-event-stream v1.1.8
 react-event-stream is custom a React Hook that wraps built-in EventSource object.
react-event-stream simplifies to use Server Sent Events with built-in EventSource in your react application.
More information about server-sent-events.
🕺 Install
react-event-stream uses rxjs as peerDependency, so you have to install rxjs with react-event-stream.
by using npm:
$ npm i react-event-stream rxjsby using yarn:
$ yarn add react-event-stream rxjsUsage
import React from 'react'
import useEventStream from 'react-event-stream';
const Example = () => {
    const value = useEventStream('http://localhost:8080/sse', 1000);
    return (
        <>
            {JSON.stringify(value)};
        </>
    );
};
export default Example;Made with
License
MIT © enesusta