Connect your react components to any EventSource
MIT License
Connect your react components to any EventSource
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
This project use nwb
react-eventsource is available under MIT. See LICENSE for more details.