ComponentDidMount 我想添加 fetch API 和 FirebaseAuth

尼什

我想连接 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] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

ReactJS componentDidMount和Fetch API

来自分类Dev

如果我导入 Firebase,是否还包括 FirebaseAuth 和 FirebaseDatabase?

来自分类Dev

无法从Fetch API和JSON解析数据

来自分类Dev

使用 fetch 和方法 get 调用 Api

来自分类Dev

我真的需要将forceUpdate与fetch API和ReactJS一起使用吗

来自分类Dev

Fetch API和Axios是否将304响应视为200?

来自分类Dev

WooCommerce + Ionic:无法注册和结帐 - Fetch API 无法加载

来自分类Dev

在 Javascript 中使用 fetch API 接收和处理 JSON

来自分类Dev

反应componentDidMount和setState似乎不会导致重新渲染以显示我的组件

来自分类Dev

在渲染中设置状态后,我需要更新 componentDidMount 中的 api

来自分类Dev

使用ReactJS和fetch-api无法访问和显示JSON

来自分类Dev

FirebaseAuth和FirebaseDatabase不保存谷歌的注册量

来自分类Dev

我认为 PDO fetch() 和 fetchColumn() 互相阻止

来自分类Dev

ReactJS中componentDidMount和getInitialState之间的区别

来自分类Dev

componentWillReceiveProps和componentDidMount之间的竞争条件

来自分类Dev

在 ComponentDidMount 中停止和启动 setInterval

来自分类Dev

学习 React 和使用 componentDidMount 导致错误

来自分类Dev

GoBack() 与 Android 硬件后退按钮和 componentDidMount()

来自分类Dev

React Native Fetch API不返回我的调用

来自分类Dev

我如何使用 fetch api 用它的 javascript 加载 html 页面?

来自分类Dev

React for Rest api中的ComponentDidMount问题

来自分类Dev

用componentDidMount()反应进行api调用

来自分类Dev

在componentDidMount内部模拟API调用方法

来自分类Dev

使用componentDidMount()反应js获取API

来自分类Dev

fetch 和 $.getjson 的区别

来自分类Dev

使用 fetch API 授权

来自分类Dev

使用redux-form和Fetch API进行服务器验证

来自分类Dev

JavaScript的Fetch API的“ same-origin”和“ no-cors”有什么区别?

来自分类Dev

React.js:使用Fetch API和对象数组中的props加载JSON数据

Related 相关文章

  1. 1

    ReactJS componentDidMount和Fetch API

  2. 2

    如果我导入 Firebase,是否还包括 FirebaseAuth 和 FirebaseDatabase?

  3. 3

    无法从Fetch API和JSON解析数据

  4. 4

    使用 fetch 和方法 get 调用 Api

  5. 5

    我真的需要将forceUpdate与fetch API和ReactJS一起使用吗

  6. 6

    Fetch API和Axios是否将304响应视为200?

  7. 7

    WooCommerce + Ionic:无法注册和结帐 - Fetch API 无法加载

  8. 8

    在 Javascript 中使用 fetch API 接收和处理 JSON

  9. 9

    反应componentDidMount和setState似乎不会导致重新渲染以显示我的组件

  10. 10

    在渲染中设置状态后,我需要更新 componentDidMount 中的 api

  11. 11

    使用ReactJS和fetch-api无法访问和显示JSON

  12. 12

    FirebaseAuth和FirebaseDatabase不保存谷歌的注册量

  13. 13

    我认为 PDO fetch() 和 fetchColumn() 互相阻止

  14. 14

    ReactJS中componentDidMount和getInitialState之间的区别

  15. 15

    componentWillReceiveProps和componentDidMount之间的竞争条件

  16. 16

    在 ComponentDidMount 中停止和启动 setInterval

  17. 17

    学习 React 和使用 componentDidMount 导致错误

  18. 18

    GoBack() 与 Android 硬件后退按钮和 componentDidMount()

  19. 19

    React Native Fetch API不返回我的调用

  20. 20

    我如何使用 fetch api 用它的 javascript 加载 html 页面?

  21. 21

    React for Rest api中的ComponentDidMount问题

  22. 22

    用componentDidMount()反应进行api调用

  23. 23

    在componentDidMount内部模拟API调用方法

  24. 24

    使用componentDidMount()反应js获取API

  25. 25

    fetch 和 $.getjson 的区别

  26. 26

    使用 fetch API 授权

  27. 27

    使用redux-form和Fetch API进行服务器验证

  28. 28

    JavaScript的Fetch API的“ same-origin”和“ no-cors”有什么区别?

  29. 29

    React.js:使用Fetch API和对象数组中的props加载JSON数据

热门标签

归档