On the Asynchronous request Middleware of redux

the problem is like this. For example, I now have a data request and pass the requested data to redux. I do this (pseudocode):

  function getData() {
    return fetch(...)
  }
  function fn() {
    getData().then(res=>{
      this.props.dispatch({
        type:"CHANGE_DATA",
        data:res
      })
    })
  }

using middleware (redux-thunk) is tantamount to stuffing a function into dispatch. The essential difference is that in what I did above, I first executed an asynchronous function, and then gave the result to dispatch, while the middleware put this function in dispatch, so there is essentially no difference between the two practices, why use middleware? This is my understanding. I don"t know where the misunderstanding is, and I hope my friends can give me a reminder. Thank you.

Jun.10,2022

  1. there is no essential difference
  2. There is an explanation for this on
  3. Readme Why Do I Need This?
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1be6209-39b8e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1be6209-39b8e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?