Q:

Remove multiple children inside a key using Firebase and React Native

The code below works as intended when removing just one child, however I need to remove multiple children, in my case 6. See attached screenshot. How would I go about adding all 6 children to the remove function?
deleteActivity= () => {
    const { currentUser } = firebase.auth();
    firebase
      .database()
      .ref(`/users/${currentUser.uid}/data/${this.state.dateForFirebase}`)
      .remove('ActivityStart1');      
  }

A:

Hi you could pass an object with the keys to remove seted to null through an atomic update.
try this and let me know if it works
deleteActivity= () => {
    const { currentUser } = firebase.auth();
    const ref = firebase.database().ref(`/users/${currentUser.uid}/data/${this.state.dateForFirebase}`)
    var atomicUpdate = {};
    atomicUpdate["ActivityAvgHR1/"] = null;
    atomicUpdate["ActivityCalories/"] = null;
    atomicUpdate["ActivityDurationHrs1/"] = null;
    atomicUpdate["ActivityDurationMns1/"] = null;
    atomicUpdate["ActivityMaxHR1/"] = null;
    atomicUpdate["ActivityStart1/"] = null;

    ref.update(atomicUpdate)

  }

