score:2

Accepted answer

the issue is with this.

instead of this,

saiindexeddb(response.data).then(function(result){
    this.setstate({
         loadingmedications: false                    
    });  
})

you need to use arrow function which auto binds this,

saiindexeddb(response.data).then((result) => {
    this.setstate({
         loadingmedications: false                    
    });  
})

score:0

another solution is assigning this to a variable and use that variable in callback

const self = this;
saiindexeddb(response.data).then(function(result){
    // replace $this with $self
    self.setstate({
         loadingmedications: false                    
    });  
})
.catch(function(error){
    console.log('error', error);
});

Related Query

More Query from same tag