export async function getLessons() {
const group = await AsyncStorage.getItem('@group');
let data;
await database()
.ref(`PI20/0/days`)
.once('value')
.then(snapshot => {
console.log(snapshot.val());
data = snapshot.val();
})
This one works fine
useEffect(() => {
console.log(getGroupList());
}, [])
async function getGroupList() {
let data;
database()
.ref(`PI20/0/days`)
.once('value')
.then(snapshot => {
console.log(snapshot.val());
data = snapshot.val();
})
return data
}
And here, .then()
is skipped. Function can be called and works untill the end, the route is good, but I can't get the snapshot because .then()
is just skipped.Why could be that?