ComponentDidMount我想添加FetchAPI和FirebaseAuth

ComponentDidMount我想添加FetchAPI和FirebaseAuth,firebase,react-native,firebase-authentication,fetch-api,Firebase,React Native,Firebase Authentication,Fetch Api,我想连接firebase的东西。我在我的新闻提要中尝试的是,当我按下addTofavourite时,它的名称应该转到firebase。所以在我的获取代码中,我使用了componentDidMount,在发送时也使用了componentDidMount。我不知道如何连接它们 这是我试过的,但不起作用 componentDidMount() { firebase.auth().signInWithEmailAndPassword ("web@imandy.ie", "123456") /

我想连接firebase的东西。我在我的新闻提要中尝试的是,当我按下addTofavourite时,它的名称应该转到firebase。所以在我的获取代码中,我使用了componentDidMount,在发送时也使用了componentDidMount。我不知道如何连接它们

这是我试过的,但不起作用

componentDidMount() {
   firebase.auth().signInWithEmailAndPassword
   ("web@imandy.ie", "123456")
//////////////////////////////////////
   this.fetchNews();
  }
为了获取新闻

 componentDidMount() {
    this.fetchNews();
  }
火基的东西

componentDidMount() {

        firebase.auth().signInWithEmailAndPassword("web@imandy.ie", "123456" )
    }

您必须在ComponentWillReceiveProps{}或componentDidUpdate{}中调用此函数。请这样尝试

componentDidMount=async=>{ const{user}=await firebase.auth。signInWithEmailAndPasswordweb@imandy.ie, 123456; //如果要使用用户详细信息,请在此处编写代码 // ... 这是一条新闻; }