'How to get return from dispatch() in react-redux?

Store

reducers: {
 updateProduct: (state, action) => {
  let { id } = action.payload;
  .....
  .....
  .....
  }
}

Dispatching from a function in component

let dispatch = useDispatch();
dispatch({ type: 'products/updateProduct' });

How can I know that product is updated successfully

I want something like this

reducers: {
 updateProduct: (state, action) => {
  let { id } = action.payload;
  .....
  .....
  return true;
  }
}
=============
let dispatch = useDispatch();
let status = dispatch({ type: 'products/updateProduct' });
if(status){
 alert()
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source