firebase get key of last node created

前端 未结 1 1768
借酒劲吻你
借酒劲吻你 2021-01-25 07:21

I am trying to get the key of the last node I have just pushed to on firebase but my code keeps erroring

constructor (props) {
super(props)
this.cartFirebase = f         


        
1条回答
  •  借酒劲吻你
    2021-01-25 07:45

    You need to use limitToLast function.

    this.cartFirebase.limitToLast(1).on('child_added', function(childSnapshot) {
    
         var snap = childSnapshot.val();
    
    });
    

    0 讨论(0)
提交回复
热议问题