Using Effect to Debounce and Cancel Async Calls in React

Hey! I have a react component which has some state called searchTerm. I want to debounce this for 300ms, then call an async search function and get the result. If searchTerm changes before the async call completes I want to cancel (i.e. ignore) the previous search and start a new one. Is that a good use-case for Effect?
Was this page helpful?