Skip to content

Chensokheng/crud-todo-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Description

This is a simple todo app with react and firebase realtime database.

install

npm install

crud

create

    const ref = firebase.database().ref("your ref");
    // initialize data
    const data = {....}
    //add to db
    ref.push(data);

delete entire data

const ref = firebase.database().ref('your ref');
ref.remove(data);

delete child data

const child = firebase.database().ref('parent').child(id);
child.remove();

update

    //select which child you want to update
    const child = firebase.database().ref("partent").child(id);
    child.update({
        complete:true,
        ...
    })

read

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*/

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published