Currently, I am in the process of developing a React application that retrieves data from Firebase.
Whenever I use the function below to delete a record, my attempt to refresh the page and display an updated view without the deleted record fails:
deleteWorkout(id, e) {
e.preventDefault();
fire.database().ref("athlete")
.child(id).remove() // <-- This works
// The following code does not work!
// Error: '_this4.getAthleteData' is undefined)
.then(() => this.getAthleteData().bind(this))
.catch(e => console.log(e));
}
I have already defined the getAthleteData() function, so I assume it might be related to a scope issue within the Promise?
getAthleteData() {...}
Any attempts to call
this.setState({...})
also results in the same error message being displayed.