ee-observer-mixin
v0.0.1
Published
Mixin for listening to Event Emitters from React components
Downloads
1
Readme
Official sound effects (see Livefyre/Observer).
The EEObserverMixin adds a .listenTo
method to a React component. Events that are subscribed to using this method will have their handlers automatically unsubscribed when the component unmounts.
Usage
npm install ee-observer-mixin
var EEObserverMixin = require('ee-observer-mixin');
var React = require('react');
React.createClass({
componentDidMount: function () {
this.listenTo(eventEmitter, 'eventName', callback);
},
mixins: [EEObserverMixin]
});