1.0.3 • Published 9 years ago
smallorange-reactive-store-react v1.0.3
React Component for Small Orange Reactive Store
It attaches observables helpers to react components, and automatically tearsdown when destroyed;
Methods
	on(...filter: string, replay: boolean = false): Observable<any>;
	once(...filter: string, replay: boolean = false): Observable<any>;
	trigger(key: string, data: any = null): void;Usage
	import React from 'react';
	import {
		Component
	} from 'smallorange-reactive-store-react';
	export class Messages extends Component {
		constructor(props) {
			super(props);
			this.state = {
				data: []
			};
		}
		componentDidMount() {
			this.on('inputChange')
				.subscribe(doSomething);
			this.once('destroy')
				.subscribe(() => console.log('Bye!'));
		}
		render() {
			return (
				<input type="text" onChange={e => this.trigger('inputChange', e)}>
			);
		}
	}