_firebase__WEBPACK_IMPORTED_MODULE_5__.default.collection is not a function

making a discord clone, im trying to use the database in firebase but it doesnt seem to be working I keep getting this error, “firebase__WEBPACK_IMPORTED_MODULE_5_.default.collection is not a function” heres my code

    useEffect(() => {
        db.collection('channels').onSnapshot((snapshot) => 
            setChannels(
                snapshot.docs.map((doc) => ({
                id: doc.id,
                channel: doc.data(),
            })) 
          ) 
        );
    }, []);

btw this is how I declared my database in firebase.js

const db = getFirestore(app);

looked around everywhere but I cant seem to find an answer