I'm trying to get data from firebase within react Native Application.
Attached below is my database: enter image description here
QWA17SaADRdgluvVnYrXJK1AvI22
-L-uNMmDRnKTkk55KbMz
allowGPS: true
notificationSound: true
phone: "345345345345345"
pushNotification: true
shareData: true
showAlerts: true
Below is the code that I've tried and they are not working. Can someone please guide me how can I get the nested values.
firebase.database().ref(`/users/${currentUser.uid}`)
.once('value').then((snapshot) => {
const username = (snapshot.val() && snapshot.val().username) || 'Anonymous';
console.log(snapshot.val().username);
console.log(snapshot.val());
console.log(snapshot.val('username'));
console.log(snapshot.child('phone').val());