【发布时间】:2021-05-23 11:20:53
【问题描述】:
我是 react-native developer,是 firebase 的新手。我正在执行 firebase 实时数据库操作,请看下面的代码;
firebase.database().ref('events/wedding/items').push(object).then((data) => {
//success callback
dispatch(addPendingInvoice({ ...invoice, id: data.key }))
Alert.alert('Successfully added to Invoices', 'Please go to invoice section to clear first and continue.', [{ text: 'Ok' }])
}).catch((error) => {
//error callback
Alert.alert("Can't book package.", 'Please check your internet connection!', [{ text: 'OK', style: 'destructive' }])
})
现在,我希望将另一个对象推送到另一个节点 events/wedding/packages 就在上面的这个 firebase 数据库函数之后。我可以在里面使用另一个函数,然后在上面的 firebase 函数中回调。这不是专业的方法。
有什么办法吗?
【问题讨论】:
标签: javascript firebase react-native firebase-realtime-database expo