Skip to content

Instantly share code, notes, and snippets.

@amorkovin
Created July 8, 2020 20:00
Show Gist options
  • Save amorkovin/2ac5dcd8392576dbd92bf7b96b393a75 to your computer and use it in GitHub Desktop.
Save amorkovin/2ac5dcd8392576dbd92bf7b96b393a75 to your computer and use it in GitHub Desktop.
Firebase
// Получаю данные из firebase
componentDidMount() {
database.ref(this.urlRequest).once('value').then(res=>{
this.setState({
wordArr: res.val() || [],
})
})
}
// Другой метод получения данных. Он будет следить за изменениями данных.
componentDidMount() {
database.ref(this.urlRequest).on('value', res=>{
this.setState({
wordArr: res.val() || [],
})
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment