Do I have to use redux-thunk to handle async?

redux-thunk enhances that dispatch, can dispatch a function and pass in two parameters, dispatch and getState. I know it"s used to handle asynchronism, but I think it doesn"t have to be used. I don"t know if it"s easy to manage the code or for other purposes. I hope God can answer

.
//
this.props.dispatch(function(dispatch,getState){
  //
  setTimeout(function(){
    dispatch({
      type:"updateState"
    })
  },3000)
})

//
let _this = this ;
setTimeout(function(){
  _this.props.dispatch({
    type:"updateState"
  })
},3000)
Mar.24,2021

it is recommended to take a look at the question http://www.ruanyifeng.com/blo.


the author of redux has already answered Portal

Menu