I have api file with requests
import * as axios from "axios";
export const productAPI = {
getProducts() {
    return axios({
        method: 'get',
        url: `/api/products`
    });
}
};
which reaches to transport.js and sends request(i think that part is not important). 
Method above is called from my component like this
 useEffect(()=> {
    setLoading(true);
    productAPI.getProducts()
        .then((response) => {
            if(response.status === 200) {
                history.push(`${pathWithLocation}${PAGES.newLoan}`);
            }
        })
        .catch((error) => {
            if (error.response.data.error.message) {
                dispatch(addModal({
                    type: 'basic',
                    size: 'middle',
                    title: 'some title',
                    text: error.response.data.error.message,
                    buttons: [{ buttonLabel: 'ОК', onClick: ()=> dispatch(removeModal()) }]       
                }))
            }
        })
        .finally(() => {
            setLoading(false);
        });
},[])
I want to cancel this specific request when component is unmounted. (switched route for example)
 
     
    