CRUD in Firebase

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'); }) 
Enter fullscreen mode
Exit fullscreen mode

Discover more from Coursity

Subscribe to get the latest posts sent to your email.

Leave a Comment

Your email address will not be published. Required fields are marked *

Discover more from Coursity

Subscribe now to keep reading and get access to the full archive.

Continue reading

Scroll to Top
Becoming a web developer : what you need to know. © invogue web design agency.