我想连接 firebase 的东西。我在我的新闻提要中尝试的是当我按下addTofavourite
它的名字时应该转到 firebase。所以在我的 fetch 代码中,我使用componentDidMount
和发送也有componentDidMount
. 我不知道如何连接它们。
这是我尝试过的,但它不起作用。
componentDidMount() {
firebase.auth().signInWithEmailAndPassword
("[email protected]", "123456")
//////////////////////////////////////
this.fetchNews();
}
获取新闻
componentDidMount() {
this.fetchNews();
}
对于火力的东西
componentDidMount() {
firebase.auth().signInWithEmailAndPassword("[email protected]", "123456" )
}
请尝试这样
componentDidMount = async () => {
const { user } = await firebase.auth().signInWithEmailAndPassword("[email protected]", "123456");
// If you want to use user detail, write code here
// ...
this.fetchNews();
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句