For some reason this works
const docRef = doc(db, "users", "1");
const docSnap = await getDoc(docRef);
const currentWeek = docSnap.get('currentWeek')
const onLoadPage = docSnap.get('currentPage')
But this doesn't
function getCurrentPage() {
const docRef = doc(db, "users", "1");
const docSnap = await getDoc(docRef);
const currentWeek = docSnap.get('currentWeek')
};
It hangs up on the 'await' and the console says
Unexpected reserved word (Points to await)
Why does it work the first time but not the second? This happens all the time and I dont understand it
It seems to me that this is happening because await is being used consecutively. Await seems to work when used localy within things but if its used twice in a open area it doesn't seem to like it