# react-event-stream

> react-event-stream is custom react hooks library.

Latest version **1.1.8** (published 2022-08-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-event-stream
pnpm add react-event-stream
yarn add react-event-stream
bun add react-event-stream
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.8 |
| Published | 2022-08-01 |
| First published | 2020-09-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=8 |
| Dependencies | 0 |
| Unpacked size | 7.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | enesusta |
| Maintainers | enesusta |

## Links

- npm: https://www.npmjs.com/package/react-event-stream
- Repository: https://github.com/enesusta/react-event-stream
- Homepage: https://github.com/enesusta/react-event-stream#readme
- Issues: https://github.com/enesusta/react-event-stream/issues
- npm.io page: https://npm.io/package/react-event-stream

## Recent versions

- 1.1.8 (latest) — 2022-08-01
- 1.1.7 — 2022-07-29
- 1.1.6 — 2022-07-29
- 1.1.5 — 2022-07-28
- 1.1.4 — 2022-07-28
- 1.1.2 — 2022-07-28
- 1.1.1 — 2022-07-28
- 1.1.0 — 2022-07-28
- 1.0.9 — 2022-07-28
- 1.0.8 — 2022-07-28
- 1.0.7 — 2022-07-28
- 1.0.6 — 2022-07-28
- 1.0.5 — 2022-07-28
- 1.0.4-rc — 2022-07-28
- 1.0.2 — 2022-07-28
- … 2 more at https://npm.io/package/react-event-stream/versions

## README

<br/>

<div align="center">

 `react-event-stream ` is custom a React Hook that wraps built-in **EventSource** object.

![npm](https://img.shields.io/npm/v/react-event-stream?color=orange&style=for-the-badge)
[![CodeFactor](https://www.codefactor.io/repository/github/enesusta/react-event-stream/badge?style=for-the-badge)](https://www.codefactor.io/repository/github/enesusta/react-event-stream)
![npm bundle size](https://img.shields.io/bundlephobia/min/react-event-stream?color=orange&style=for-the-badge)
![NPM](https://img.shields.io/npm/l/react-event-stream?color=blue&style=for-the-badge)
![npm](https://img.shields.io/npm/dm/react-event-stream?style=for-the-badge)
[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg?style=for-the-badge&color=black)](https://standardjs.com)
</div>

react-event-stream simplifies to use **Server Sent Events** with built-in [EventSource](https://developer.mozilla.org/en-US/docs/Web/API/EventSource) in your react application.

More information about [server-sent-events.](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events)


## 🕺 Install

react-event-stream uses [*rxjs*](https://github.com/ReactiveX/rxjs) as **peerDependency**, so you have to install **rxjs** with react-event-stream.

by using `npm`:
```bash
$ npm i react-event-stream rxjs
```

by using `yarn`:

```bash
$ yarn add react-event-stream rxjs
```

## Usage

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

- [React](https://reactjs.org/)
- [Rollup](https://rollupjs.org/guide/en/)


## License

MIT © [enesusta](https://github.com/enesusta)

---
_Source: https://npm.io/package/react-event-stream · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
