All Projects → revolunet → react-eventsource

revolunet / react-eventsource

Licence: MIT license
Connect your react components to any EventSource

Programming Languages

javascript
184084 projects - #8 most used programming language

react-eventsource

Connect your react components to any EventSource

Usage

import ReactEventSource from 'react-eventsource'

const renderEvent = event => <div>{ event }</div>

<ReactEventSource url="https://stream.wikimedia.org/v2/stream/recentchange">
    { events => events.map(renderEvent) }
</ReactEventSource>

By default, ReactEventSource will listen to message events.

If you use custom message types, you can specify them using types={['data', 'patch']}

You can pass your own EventSource using source prop source={new EventSource(url)},

See working demo with Live Bitcoin value update : http://revolunet.github.io/react-eventsource/#/demo

Dev

This project use nwb

License

react-eventsource is available under MIT. See LICENSE for more details.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].