How to put an end to the events that happened after componentWillUnMount?

the problem is this: one of my pages will request a slower interface, and through the data in the interface, the url of the page will be changed to query some data (for example, the id, of a bunch of institutions displays the data of the first organization through the first id query. But when you quickly click the menu to switch to another page, you will jump back to the previous page after a while. But during the switch, the componentWillUnmount in the previous page code is triggered, but what happens after the request for the slow interface (which is actually the push method of the history object) still happens. What"s going on?

Jul.16,2021

cancel the request with.

  https://reactjs.org/blog/2015.

Menu