Skip to content

Instantly share code, notes, and snippets.

@roman01la
Created January 26, 2015 01:39
Show Gist options
  • Save roman01la/8ba85ce6f5eec57964a7 to your computer and use it in GitHub Desktop.
Save roman01la/8ba85ce6f5eec57964a7 to your computer and use it in GitHub Desktop.
Reactive React components using Most
import React from 'react';
import most from 'most';
let push = ({source: {sink}}, event) => {
try {
sink.event(event.type, event);
} catch (err) {
sink.error(event.type, err);
}
};
let Button = React.createClass({
_onClick: push.bind(null, (() => {
let clicks = most.create(() => {});
clicks.forEach(console.log.bind(console));
return stream;
})()),
render() {
return <button onClick={this._onClick}>Click Me!</button>;
}
});
React.render(<Button />, document.body);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment