DEV Community

Discussion on: The Axios Cancel Token In React (Advanced React Made Simple)

Collapse
 
nombrekeff profile image
Keff

I think that for the problem mention, you would be better just doing debouncing on your text field instead, no need to perform the api call. The theory behind debouncing is simple, each time the user enters a key you delay a function call by some amount, if another key is pressed the last function is canceled and a new call is delayed. Until one of the calls executes, then you perform the call to the API.

Collapse
 
ishakmohmed profile image
Mohmed Ishak

I just got to know debouncing from you. Thanks man.

Collapse
 
nombrekeff profile image
Keff

Great stuff! It's a really useful concept to know!