Ama*_*oux 0 firebase react-native firebase-realtime-database
大家好我怎样才能从这种数据库结构中请求所有数据?
我试过这个,但它不起作用:
var recentPostsRef = firebase.database().ref('/store');
Run Code Online (Sandbox Code Playgroud)
您处于正确的轨道上,但缺少.then()与回调一起使用的检索部分:
var recentPostsRef = firebase.database().ref('/store');
recentPostsRef.once('value').then(snapshot => {
// snapshot.val() is the dictionary with all your keys/values from the '/store' path
this.setState({ stores: snapshot.val() })
})
Run Code Online (Sandbox Code Playgroud)
该firebase.database.Reference文档有很多很好的例子和解释可以提供帮助.
| 归档时间: |
|
| 查看次数: |
7395 次 |
| 最近记录: |