RxJS and React's setState - delay function execution until subscription
RxJS has a nifty function, fromCallback that takes a function whose last parameter is a callback and returns an Observable . And I want to combine that with React's setState function so that I can do something analogous to: const setState = Rx.Observable.fromCallback(this.setState); setState({ myState: 'Hi there!' }).concat(....) so that any operations chained to setState are guaranteed to happen after the state has been set and, most importantly, that setState isn't invoked until there's an active subscriber. What I noticed though is that even without a subscribe, setState is being called