This is a simple todo app with react and firebase realtime database.
npm install
const ref = firebase.database().ref("your ref");
// initialize data
const data = {....}
//add to db
ref.push(data);
const ref = firebase.database().ref('your ref');
ref.remove(data);
const child = firebase.database().ref('parent').child(id);
child.remove();
//select which child you want to update
const child = firebase.database().ref("partent").child(id);
child.update({
complete:true,
...
})
const ref = firebase.database().ref('parent');
ref.on('value', (snapshot) => {
console.log(snapshot.val());
});
/* this will listen to the parent if there is something change */
ref.once('value', (snapshot) => {
console.log(snapshot.val());
});
/* this will listen only one time*/