Install
npm install react-pusher-hoc --save# or yarn add react-pusher-hoc
Usage
- To use react-pusher, you need to pass the pusher instance to the
PusherProvider
as following:
;; const pusherClient = <your_config>...; <PusherProvider value=pusherClient> <App /></PusherProvider>
- Then you can wrap your component with the HOC (where
itemChannel
is the channel name andadd
is the event name delimited by.
):
; const ItemList = <ul> items </ul>; const mapEventsToProps = items: events: items: stateitems ; mapEventsToPropsItemList;
You need to provide initialValues through the mapPropsToValues
function.
Author
- Felix Wostal @felixwostal
Support
If you like the project and want to support my work, you can think about buy me a coffee :)