CSFrequency / react-firebase-hooks

React Hooks for Firebase.
Apache License 2.0
3.6k stars 306 forks source link

useCollection not working #192

Closed kingsleykbc closed 2 years ago

kingsleykbc commented 2 years ago

Trying to use useCollection in the code below:

import React from 'react';
import { app } from '../firebase/clientApp';
import { collection, getFirestore } from 'firebase/firestore';
import { useCollection } from 'react-firebase-hooks/firestore';

const Home = props => {
    const [blogs, loading, error] = useCollection(
        collection(getFirestore(app), 'blogs'), {
        snapshotListenOptions: { includeMetadataChanges: true }
    });

    console.log(blogs);
    return (
        <Section>
            <pre>{JSON.stringify(blogs, null, 2)}</pre>
      ...

But I keep getting this error message:

index.esm.js?352f:101 Uncaught TypeError: v1.isEqual is not a function
    at isEqual (index.esm.js?352f:101)
    at eval (index.esm.js?352f:90)
    at invokePassiveEffectCreate (react-dom.development.js?ac89:23487)
    at HTMLUnknownElement.callCallback (react-dom.development.js?ac89:3945)
    at Object.invokeGuardedCallbackDev (react-dom.development.js?ac89:3994)
    at invokeGuardedCallback (react-dom.development.js?ac89:4056)
    at flushPassiveEffectsImpl (react-dom.development.js?ac89:23574)
    at unstable_runWithPriority (scheduler.development.js?bcd2:468)
    at runWithPriority$1 (react-dom.development.js?ac89:11276)
chrisbianca commented 2 years ago

@kingsleykbc which version of react-firebase-hooks do you have installed? My guess is that you might have version 3.0.x rather than v4

kingsleykbc commented 2 years ago

Yes, my bad. I am on version 3.0.5. I'll update and try again

chrisbianca commented 2 years ago

No problem, I'm going to close this issue