I'm trying to call this function
compatiblelist() {
CompatibleDevicesAPI().then(
response => {this.getCompatList(response)}
);
}
It's giving an error whenever I call {this.compatiblelist()}
The function CompatibleDevicesAPI() looks like this
export default function CompatibleDevicesAPI() {
return fetch("https://abc/jjklsd/jlasd").then((res) => {
let results = [];
for(var i=0;i<res.response.docs.length;i++){
let obj ={
'compManufacturer': res.response.docs[i].comanufacturer,
'comDisplayName': res.response.docs[i].comDisplayName ,
'id' : res.response.docs[i].id,
}
results.push(obj);
}
return results;
}).catch((error) => {
let results = [];
results.push({
'comManufacturer': 'error',
'comDisplayName': error
})
return results;
});
}
componentDidUpdate
instead – AsukaSong