the first bit gets the id and puts it into "id List" and shows it is doing this with the console.log of (doc.data()) (and other things i have no included that prove this.)
the second bit console.log(idList) shows it as empty.
How can i include a console.log(idList) with the doc.data() in it, within the useEffect?
useEffect( ()=>{
firestore.collection("Selection").doc(me.uid).collection("id").get()
.then( (querySnapshot) => {
querySnapshot.forEach(doc => {
// console.log(doc.id, " => ", doc.data());
setIdList([...idList, doc.data()]);
x= idList;
console.log("first",x, idList, doc.data())
})
}).then(()=>{
console.log("second",idList)
// Load();
});
/// IdList has the list of id's
},[])