Why do we need middleware for async flow in Redux?

前端 未结 11 2437
忘了有多久
忘了有多久 2020-11-22 04:17

According to the docs, \"Without middleware, Redux store only supports synchronous data flow\". I don\'t understand why this is the case. Why can\'t the container component

11条回答
  •  爱一瞬间的悲伤
    2020-11-22 04:47

    When working in an enterprise project, there are many requirements available in middle-ware such as (saga) not available in simple asynchronous flow, below are some:

    • Running request in parallel
    • Pulling future actions without the need to wait
    • Non-blocking calls Race effect, example pickup first
    • response to initiate the process Sequencing your tasks (first in first call)
    • Composing
    • Task cancellation Dynamically forking the task.
    • Support Concurrency Running Saga outside the redux middleware.
    • Using channels

    The list is long just review the advanced section in saga documentation

提交回复
热议问题