I'm using firebase in a react native app and I have a listener similar to this:
firebase.database().ref('users/'+uid+'/items').on('value', function(snapshot){
....
})
What I'm trying to do is to remove that listener when the user logs out. I know that I can do it using off() like:
firebase.database().ref('users/'+uid+'/items').off('value', function(snapshot){
....
})
But once the user logs out I no longer have access to the user id. So how do I remove the listener?