CRUD operation in Firebase using react and javascript
// Read db.collection('products').get().then(resposne=>{ resposne.forEach((object)=>{ console.log(object.data(),object.id); }) }) // Create db.collection('products').add({ name: 'Laptop', type: 'Electronics', price: 50000 }).then(()=>{ console.log('Added'); }) // Delete db.collection('products').doc('Q4tjiYSC05MjYG6pQBIQ').delete().then(()=>{ console.log('Deleted'); }) // Update db.collection('products').doc('BDgu0r6ECRtyUKxxkxcs').update({ name: 'Laptop', type: 'Electronics', price: 50 }).then(()=>{ console.log('Updated'); })
Discover more from Coursity
Subscribe to get the latest posts sent to your email.