无法使用firebase.firestore.FieldValue.increment [英] Unable to use firebase.firestore.FieldValue.increment

查看:35
本文介绍了无法使用firebase.firestore.FieldValue.increment的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

firestore提供了一种用于增加数字的方法值.

但是我无法使用该函数,因为该函数未定义.

But I was not able to use the function because it is undefined.

我尝试在npm中更新firebase,尝试重新安装firebase.我目前有Firebase的5.10.1版本.

I tried updating firebase in npm, tried reinstalling firebase. I currently have the 5.10.1 version of firebase.

import firebase from "../base";
...
someHandler = () => {
  someRef.update({
      count: firebase.firestore.FieldValue.increment(1)
  });
}

推荐答案

因此,我通过直接从"firebase"导入而不是导出初始化的Firebase实例的本地文件解决了我的问题.

So I solved my problem by importing directly from "firebase" instead of my local file which exports an initialized firebase instance.

这篇关于无法使用firebase.firestore.FieldValue.increment的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆