Mendapatkan Data dari Firebase

// Necessary Imports
import { useEffect, useState } from "react";
import { db } from "relative path of your firebase config file";
import { collection, onSnapshot } from "firebase/firestore";

// Code inside component
const [data, setData] = useState([]);
useEffect(
        () =>
            onSnapshot(collection(db, "collectionName"), (snapshot) => {
                setData(
                    snapshot.docs.map((doc) => {
                        return { ...doc.data(), id: doc.id };
                    })
                );
            }),
		[]);


console.log(data);
Tender Turtle