Skip to content

Instantly share code, notes, and snippets.

View augustinr's full-sized avatar

Augustin Roux augustinr

View GitHub Profile
export default class Store {
constructor(state: Object) {
this.state = state;
this.callbacks = [];
}
subscribe(callback) {
this.callbacks.push(callback);
return () => this._unsubscribe(callback);
}
@augustinr
augustinr / imgWithFallBack.jsx
Created April 29, 2016 13:39
React ImgWithFallBack
class ImgWithFallBack extends Component {
constructor() {
super();
this.state = { displayCallBack: false };
}
onError() {
this.setState({ displayCallBack: true });
}