【发布时间】:2019-08-12 13:01:54
【问题描述】:
我将用户插入到 firebase 数据库中,每个用户都有自己的数据(电子邮件、姓名、年龄 ....),我尝试获取单个用户的数据 - 连接设备的用户 - 我的功能是带来数据,但是它带来了整个数据库,所有用户,你能帮忙解决这个问题吗? 这是我的代码:
componentWillMount(){
firebase.auth().onAuthStateChanged((user) => {
if (user) {
firebase.database().ref('friends')
.on('value', (snapshot) => {
const data = snapshot.val() || [];
this.handleData(data);
});
}
});
}
【问题讨论】:
标签: firebase react-native firebase-realtime-database firebase-authentication