Skip to content

Instantly share code, notes, and snippets.

@syamjayaraj syamjayaraj/App.js
Created Aug 7, 2018

Embed
What would you like to do?
componentDidMount() {
this.timer=setInterval(() =>this.getDonor(), 1000);
}
async getDonor() {
return fetch(`https://blood-donors-db.firebaseio.com/donors.json`)
.then((response) => response.json())
.then((responseJson) => {
this.setState({
donors: Object.values(responseJson),
});
})
.catch((error) => {
console.error(error);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.