I want to cancel an Axios request when clicking the button in react js
I read Axios documentation but don't find it
I want to cancel an Axios request when clicking the button in react js
I read Axios documentation but don't find it
You can use this from https://axios-http.com/docs/cancellation
const controller = new AbortController();
axios.get('/foo/bar', {
signal: controller.signal
}).then(function(response) {
//...
});
// cancel the request
controller.abort()