class Timer extends React.Component {
state = {
value: 0
}
subscription = undefined;
componentWillMount() {
this.subscription = Rx.Observable.timer(0, 1000).timestamp().subscribe(::this.setState);
}
componentWillUnmount() {
this.subscription.dispose();
}
render() {
return <div>{ this.state.value }</div>
}
}