class StoreEvent {
static CHANGE = "string";
}
class Store {
constructor(){
this.value = null;
this.dispatcher = new EventEmetter(); // вы можете использовать любой другой
}
getValue(){
return this.value;
}
setValue(value){
this.value = value;
this.dispatcher.emit(StoreEvent.CHANGE);
}
}
class SomeComponent extends Component {
state = {}
componentWillMount() {
this.props.store.on(StoreEvent.CHANGE, this.store_changeHandler);
}
store_changeHandler = ()=> {
this.setState({...})
}
}