Why use Redux-Observable over Redux-Saga?

前端 未结 7 1165
太阳男子
太阳男子 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:55

    If you write your application in Typescript, I recommend checking typeless. It's inspired by Redux-Observable, and also depends on RxJS, but there is the whole ecosystem for building the app.

    The biggest cons of redux-observable/redux-saga are lack of guidelines. There are no official guidelines on how to lazy load reducers, sagas or epics. Code splitting is critical when scaling bigger apps. Custom solutions for lazy loading usually don't work with HMR causing poor developer experience.

    Typeless pros:

    1. Designed for TypeScript
      All APIs are designed for typescript and type-safety:
      • Typescript will boost your productivity, not slows you down.
      • Only the necessary annotations are required: state, action arguments.
      • No typecasting. Everything is inferred automatically. 95% of the code looks like pure javascript.
      • No RootAction, RootEpic, RootState or other helper types.
    2. Provide all building blocks
      • Typeless includes everything to build mid-sized or enterprise level apps.
      • You don't need to rely on multiple small libraries.
    3. Modularity
      • Proper modularity is critical for building scalable apps.
      • There is no need to create root files for epics, reducers, types, etc. Once you create a new module, you can attach it from any place. Similar to standard React components.
    4. Opinionated
      • All common use cases and problems are solved by default. No need to over-think how to fix trivial issues.
      • All recommendations and best practices are provided!

    Check out https://typeless.js.org/

    0 讨论(0)
提交回复
热议问题