Firebase 无法修复react本机承诺{quot;'U U";:0,'U V";:0,'U W";:null,'U X";:null,}中的承诺
为什么我要在函数中添加承诺?它仍然会给出错误 我不能用我给出的参数再次调用此函数 通过Fire.js文件中的Uid获取用户(我自定义此文件) 在Feed.js中我称之为Firebase 无法修复react本机承诺{quot;'U U";:0,'U V";:0,'U W";:null,'U X";:null,}中的承诺,firebase,react-native,Firebase,React Native,为什么我要在函数中添加承诺?它仍然会给出错误 我不能用我给出的参数再次调用此函数 通过Fire.js文件中的Uid获取用户(我自定义此文件) 在Feed.js中我称之为 async componentDidMount() { await firebase.firestore().collection("Post").get() .then(querySnapshot => { querySn
async componentDidMount() {
await firebase.firestore().collection("Post").get()
.then(querySnapshot => {
querySnapshot.forEach(documentSnapshot => {
this.setState({ dataPost: this.state.dataPost.concat({ ...documentSnapshot.data(),
key: documentSnapshot.id, }) })
console.log(Fire.shared.getUserbyUid(documentSnapshot.data().uid)); <= error this if i console.log(documentSnapshot.data().uid)) it will return a Uid
but If i call in above it will return Promise { "_U": 0,"_V": 0, "_W": null,"_X": null,}
});
});
}
异步组件didmount(){
等待firebase.firestore().collection(“Post”).get()
.然后(querySnapshot=>{
querySnapshot.forEach(documentSnapshot=>{
this.setState({dataPost:this.state.dataPost.concat({…documentSnapshot.data(),
关键字:documentSnapshot.id,})})
log(Fire.shared.getUserbyUid(documentSnapshot.data().uid));
async componentDidMount() {
await firebase.firestore().collection("Post").get()
.then(querySnapshot => {
querySnapshot.forEach(documentSnapshot => {
this.setState({ dataPost: this.state.dataPost.concat({ ...documentSnapshot.data(),
key: documentSnapshot.id, }) })
console.log(Fire.shared.getUserbyUid(documentSnapshot.data().uid)); <= error this if i console.log(documentSnapshot.data().uid)) it will return a Uid
but If i call in above it will return Promise { "_U": 0,"_V": 0, "_W": null,"_X": null,}
});
});
}