Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Opinions on reactive vs promises?


Reactive (event) streams are a generalization of promises in a sense, from a single value to a stream of multiple ones. Both are monads.

Streams are to promises what lists are to maybes (options).


Reactive is really good for events which could happen zero to infinite times. The composition model is great for that, because we treat these as collections that you can query just as you would query an Array in JavaScript.

Promises on the other hand, are more for scalar values and composition is rather limited based upon that. However, RxJS plays very well with Promises such as the following: https://gist.github.com/mattpodwysocki/b57cf50a34f22ba39e4f . This really shows where Promises leave off and true good composition starts.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: