A
A
Artem2019-10-12 22:03:12
redux
Artem, 2019-10-12 22:03:12

Is there a tool to cancel the execution of an asynchronous dispatch?

Actually the question is in the title. Is there an api out of the box to undo consecutive actions?
Example: Switching between tabs, for each tab we go to api. It happens that by clicking on button 1 and immediately on button 2, request 1 takes longer than request 2. The result is drawing data from request 1.
UPD. There are also complex examples. When, after we received a response from the api, we pull other actions.
Checking the relevance in each is difficult.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
abberati, 2019-10-13
@Cruper

There is none out of the box. Out of the box, you can’t work with asynchronous code at all. Redux-saga provides the functionality you need.
https://redux-saga.js.org/docs/advanced/TaskCancel...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question