0

I have a function in my Redux reducer that makes a few async calls to get product description, then downloads a catalog of images to the local storage and then sets the descriptions to the redux state.

I want to be able to stop the function no matter at which point of execution it is on Cancel button press. I know that JS is single-threaded but I'm just wondering if there is a workaround

Oleksandr Fomin
  • 2,005
  • 5
  • 25
  • 47
  • 1
    Does this answer your question https://stackoverflow.com/questions/37624144/is-there-a-way-to-short-circuit-async-await-flow? – MohammadAmin Mohammadi Apr 16 '20 at 14:33
  • I ended up using axios.CancelToken, I think under the hood it uses the logic described in the post you sent but it's a bit cleaner and certainly easier to use – Oleksandr Fomin Apr 17 '20 at 09:20

0 Answers0