[英]how to write firebase v8 code using firebase v9
You need to check the Firebase documentation for the upgrade to V9, and you need update your library react-firebase-hooks
to 4.0.0 version ( here documentation ).您需要查看Firebase 文档以升级到 V9,并且需要将库
react-firebase-hooks
更新到 4.0.0 版本( 此处文档)。
In your example, it would look like this:在您的示例中,它看起来像这样:
import { useCollection } from 'react-firebase-hooks/firestore'
import { getFirestore, collection, query, where } from 'firebase/firestore'
const db = getFirestore(firebaseApp);
const q = query(collection(db, 'chats'), where('users', 'array-contains', user.email));
const [value, loading, error] = useCollection(
q,
{ snapshotListenOptions: { includeMetadataChanges: true } }
)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.