I am trying to update my Vue component's state by getting a reference to a node in firebase, iterate through all its children and store it into a variable. Any idea on how to do that? I am not able to access any of my component's global, data, or state variables within firebase's '.on' functions.
This is my data for my vue component
data () {
return {
authID : '',
tab_names : ['tab']
}
},
Where tab_names is an array list where I would to push new variables from firebase.
tabList.on('value', function(snapshot){
snapshot.forEach(function(child){
var key = child.key;
var value = child.val();
//cant access this.tab_names, or even variables from vuex store
});
});
Because I cannot access any variables to update my state, how would I go about solving this? Sorry