-1
私はちょうどfirebase上にプッシュしている最後のノードのキーを取得しようとしていますが、私のコードは、あなたがlimitToLast
を使用する必要がfirebaseは、作成した最後のノードのキーを取得
constructor (props) {
super(props)
this.cartFirebase = firebaseApp.database().ref('carts')
}
componentDidMount() {
this.cartFirebase.child(DeviceInfo.getUniqueID() + '/items').push({
item: this.props.data.name,
qty: 1
})
this.cartFirebase.limit(1).on('child_added', function(snapshot) {
console.log(snapshot)
})
}
あなたが得るエラーは何ですか? –
こんにちは@FrankvanPuffelenはエラーを追加しました –
エラーメッセージに 'limit()'は関数ではないと書かれています。あなたは 'limitToFirst()'や 'limitToLast()'を探していますか? –