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.