const [data, setData] = useState([]);
const takeData = async () => {
const UID = getAuth().currentUser.uid;
const db = getFirestore();
const q = query(collection(db, "users", UID, "statistic"));
const querySnapshot = await getDocs(q);
querySnapshot.forEach((doc) => {
console.log(doc.data());
setData([...data, doc.data()]);
});
};
useEffect(() => {
takeData();
}, []);
const [data, setData] = useState([]);
const takeData = async () => {
const UID = getAuth().currentUser.uid;
const db = getFirestore();
const q = query(collection(db, "users", UID, "statistic"));
const querySnapshot = await getDocs(q);
setData(querySnapshot.map((doc) => doc.data()));
};
useEffect(() => {
takeData();
}, []);