Why use Redux-Observable over Redux-Saga?

前端 未结 7 1206
太阳男子
太阳男子 2020-12-22 15:22

I have used Redux-Saga. Code written with it is easy to reason so far, except JS generator function is messing up my head from time to time. From my understanding, Redux-Obs

7条回答
  •  清歌不尽
    2020-12-22 15:42

    Redux-Observable is an amazing library, we use it in production for 1.5 years without any issues so far, it's perfectly testable and can be easily integrated with any framework. We are having extremely overloaded parallel socket channels and the only thing which is saving us from freezes is Redux-Observable

    I have 3 points I'd like to mention here.

    1. Complexity and learning curve

    Redux-saga easily beats redux-observable here. If you need just a simple request to get authorization done and you don't want to use redux-thunk for some reasons, you should consider using redux-saga, it's just easier to understand.

    If you don't have prior knowledge of Observable it will be a pain for you and your team will course you :)

    2. What can Observable and RxJS offer to me?

    When it comes to async logic Observable is your Swiss knife, Observable can literally do almost everything for you. You should never compare them to promises or generators it's far more powerful, it's same like comparing Optimus Prime with Chevrolet.

    And what about RxJS? It's like lodash.js but for async logic, once you in you will never switch to something different.

    3. Reactive extension

    Just check this link

    http://reactivex.io/languages.html

    The reactive extension is implemented for all modern programming languages, it's just your key to functional programming.

    So spend your time wisely learn RxJS and use redux-observable :)

提交回复
热议问题