当我尝试使用npm install将Firebase与React native一起使用时,出现错误。
然后,当我尝试对Firebase模块使用require时,它说找不到该文档。
有没有办法将Firebase API与React native结合使用?
Firebase使用WebSocket,React Native目前不支持。到目前为止,还没有将Firebase与React Native集成的好的解决方案。
代替要求将Firebase作为模块,您确实可以使用firebase API。如果您正在执行简单的get请求,则您的提取函数将如下所示:
var url = "https://YourDatabaseName.firebaseio.com/some/val.json";
fetch(url)
.then((response) => response.json())
.then((responseData) => {
console.log(responseData);
})
.done();
有关更多信息,您可以在此处查看我撰写的有关该主题的博客文章:http : //anuj.io/using-firebase-api-with-react/
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句